| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (' =:[({;,!+-*/&|^<>.'.indexOf(lineText.charAt(index)) !== -1) | 245 if (' =:[({;,!+-*/&|^<>.'.indexOf(lineText.charAt(index)) !== -1) |
| 246 break; | 246 break; |
| 247 } | 247 } |
| 248 return new WebInspector.TextRange(lineNumber, index + 1, lineNumber, columnN
umber); | 248 return new WebInspector.TextRange(lineNumber, index + 1, lineNumber, columnN
umber); |
| 249 } | 249 } |
| 250 | 250 |
| 251 /** | 251 /** |
| 252 * @param {!WebInspector.TextRange} queryRange | 252 * @param {!WebInspector.TextRange} queryRange |
| 253 * @param {!WebInspector.TextRange} substituteRange | 253 * @param {!WebInspector.TextRange} substituteRange |
| 254 * @param {boolean=} force | 254 * @param {boolean=} force |
| 255 * @param {string=} tokenType |
| 255 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>} | 256 * @return {!Promise<!WebInspector.SuggestBox.Suggestions>} |
| 256 */ | 257 */ |
| 257 _wordsWithQuery(queryRange, substituteRange, force) { | 258 _wordsWithQuery(queryRange, substituteRange, force, tokenType) { |
| 258 var query = this._editor.text(queryRange); | 259 var query = this._editor.text(queryRange); |
| 259 var before = this._editor.text(new WebInspector.TextRange(0, 0, queryRange.s
tartLine, queryRange.startColumn)); | 260 var before = this._editor.text(new WebInspector.TextRange(0, 0, queryRange.s
tartLine, queryRange.startColumn)); |
| 260 var historyWords = this._historyCompletions(query, force); | 261 var historyWords = this._historyCompletions(query, force); |
| 261 return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContex
t(before, query, force) | 262 return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContex
t(before, query, force, tokenType) |
| 262 .then(innerWordsWithQuery); | 263 .then(innerWordsWithQuery); |
| 263 /** | 264 /** |
| 264 * @param {!Array<string>} words | 265 * @param {!Array<string>} words |
| 265 * @return {!WebInspector.SuggestBox.Suggestions} | 266 * @return {!WebInspector.SuggestBox.Suggestions} |
| 266 */ | 267 */ |
| 267 function innerWordsWithQuery(words) { | 268 function innerWordsWithQuery(words) { |
| 268 return words.map(item => ({title: item})).concat(historyWords); | 269 return words.map(item => ({title: item})).concat(historyWords); |
| 269 } | 270 } |
| 270 } | 271 } |
| 271 | 272 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return this._currentHistoryItem(); | 356 return this._currentHistoryItem(); |
| 356 } | 357 } |
| 357 | 358 |
| 358 /** | 359 /** |
| 359 * @return {string|undefined} | 360 * @return {string|undefined} |
| 360 */ | 361 */ |
| 361 _currentHistoryItem() { | 362 _currentHistoryItem() { |
| 362 return this._data[this._data.length - this._historyOffset]; | 363 return this._data[this._data.length - this._historyOffset]; |
| 363 } | 364 } |
| 364 }; | 365 }; |
| OLD | NEW |