Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js

Issue 2468493004: DevTools: Consolidate completion code into JavaScriptAutocomplete.js (Closed)
Patch Set: merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.Widget} 7 * @extends {WebInspector.Widget}
8 */ 8 */
9 WebInspector.ConsolePrompt = function() 9 WebInspector.ConsolePrompt = function()
10 { 10 {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 /** 267 /**
268 * @param {!WebInspector.TextRange} prefixRange 268 * @param {!WebInspector.TextRange} prefixRange
269 * @param {!WebInspector.TextRange} substituteRange 269 * @param {!WebInspector.TextRange} substituteRange
270 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>} 270 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>}
271 */ 271 */
272 _wordsWithPrefix: function(prefixRange, substituteRange) 272 _wordsWithPrefix: function(prefixRange, substituteRange)
273 { 273 {
274 var prefix = this._editor.text(prefixRange); 274 var prefix = this._editor.text(prefixRange);
275 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRa nge.startLine, prefixRange.startColumn)); 275 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRa nge.startLine, prefixRange.startColumn));
276 var historyWords = this._historyCompletions(prefix); 276 var historyWords = this._historyCompletions(prefix);
277 return WebInspector.ExecutionContextSelector.completionsForTextInCurrent Context(before, prefix, true /* force */).then(innerWordsWithPrefix); 277 return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentCo ntext(before, prefix, true /* force */).then(innerWordsWithPrefix);
278 278
279 /** 279 /**
280 * @param {!Array<string>} words 280 * @param {!Array<string>} words
281 * @return {!WebInspector.SuggestBox.Suggestions} 281 * @return {!WebInspector.SuggestBox.Suggestions}
282 */ 282 */
283 function innerWordsWithPrefix(words) 283 function innerWordsWithPrefix(words)
284 { 284 {
285 return words.map(item => ({title:item})).concat(historyWords); 285 return words.map(item => ({title:item})).concat(historyWords);
286 } 286 }
287 }, 287 },
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 }, 381 },
382 382
383 /** 383 /**
384 * @return {string|undefined} 384 * @return {string|undefined}
385 */ 385 */
386 _currentHistoryItem: function() 386 _currentHistoryItem: function()
387 { 387 {
388 return this._data[this._data.length - this._historyOffset]; 388 return this._data[this._data.length - this._historyOffset];
389 } 389 }
390 }; 390 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698