| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 }; |
| OLD | NEW |