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

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

Issue 2455273002: DevTools: Console now autocompletes on window for empty string (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 * @param {!WebInspector.TextRange} substituteRange 269 * @param {!WebInspector.TextRange} substituteRange
270 * @return {!Promise.<!Array.<{title: string, className: (string|undefined)} >>} 270 * @return {!Promise.<!Array.<{title: string, className: (string|undefined)} >>}
271 */ 271 */
272 _wordsWithPrefix: function(prefixRange, substituteRange) 272 _wordsWithPrefix: function(prefixRange, substituteRange)
273 { 273 {
274 var fulfill; 274 var fulfill;
275 var promise = new Promise(x => fulfill = x); 275 var promise = new Promise(x => fulfill = x);
276 var prefix = this._editor.text(prefixRange); 276 var prefix = this._editor.text(prefixRange);
277 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRa nge.startLine, prefixRange.startColumn)); 277 var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRa nge.startLine, prefixRange.startColumn));
278 var historyWords = this._historyCompletions(prefix); 278 var historyWords = this._historyCompletions(prefix);
279 WebInspector.ExecutionContextSelector.completionsForTextInCurrentContext (before, prefix, false /* Don't force */, innerWordsWithPrefix); 279 WebInspector.ExecutionContextSelector.completionsForTextInCurrentContext (before, prefix, true /* force */, innerWordsWithPrefix);
280 return promise; 280 return promise;
281 281
282 /** 282 /**
283 * @param {!Array.<string>} words 283 * @param {!Array.<string>} words
284 */ 284 */
285 function innerWordsWithPrefix(words) 285 function innerWordsWithPrefix(words)
286 { 286 {
287 fulfill(words.map(item => ({title:item})).concat(historyWords)); 287 fulfill(words.map(item => ({title:item})).concat(historyWords));
288 } 288 }
289 }, 289 },
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 }, 383 },
384 384
385 /** 385 /**
386 * @return {string|undefined} 386 * @return {string|undefined}
387 */ 387 */
388 _currentHistoryItem: function() 388 _currentHistoryItem: function()
389 { 389 {
390 return this._data[this._data.length - this._historyOffset]; 390 return this._data[this._data.length - this._historyOffset];
391 } 391 }
392 }; 392 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698