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

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

Issue 2471243002: 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.ConsolePrompt = class extends WebInspector.Widget { 7 WebInspector.ConsolePrompt = class extends WebInspector.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this._addCompletionsFromHistory = true; 10 this._addCompletionsFromHistory = true;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 /** 250 /**
251 * @param {!WebInspector.TextRange} prefixRange 251 * @param {!WebInspector.TextRange} prefixRange
252 * @param {!WebInspector.TextRange} substituteRange 252 * @param {!WebInspector.TextRange} substituteRange
253 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>} 253 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>}
254 */ 254 */
255 _wordsWithPrefix(prefixRange, substituteRange) { 255 _wordsWithPrefix(prefixRange, substituteRange) {
256 var prefix = this._editor.text(prefixRange); 256 var prefix = this._editor.text(prefixRange);
257 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRange. startLine, prefixRange.startColumn)); 257 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRange. startLine, prefixRange.startColumn));
258 var historyWords = this._historyCompletions(prefix); 258 var historyWords = this._historyCompletions(prefix);
259 return WebInspector.ExecutionContextSelector.completionsForTextInCurrentCont ext(before, prefix, true /* force */) 259 return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContex t(before, prefix, true /* force */)
260 .then(innerWordsWithPrefix); 260 .then(innerWordsWithPrefix);
261 261
262 /** 262 /**
263 * @param {!Array<string>} words 263 * @param {!Array<string>} words
264 * @return {!WebInspector.SuggestBox.Suggestions} 264 * @return {!WebInspector.SuggestBox.Suggestions}
265 */ 265 */
266 function innerWordsWithPrefix(words) { 266 function innerWordsWithPrefix(words) {
267 return words.map(item => ({title: item})).concat(historyWords); 267 return words.map(item => ({title: item})).concat(historyWords);
268 } 268 }
269 } 269 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return this._currentHistoryItem(); 354 return this._currentHistoryItem();
355 } 355 }
356 356
357 /** 357 /**
358 * @return {string|undefined} 358 * @return {string|undefined}
359 */ 359 */
360 _currentHistoryItem() { 360 _currentHistoryItem() {
361 return this._data[this._data.length - this._historyOffset]; 361 return this._data[this._data.length - this._historyOffset];
362 } 362 }
363 }; 363 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698