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

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

Issue 2474143002: DevTools: Rename prefix to query in the context of autocomplete (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js b/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
index 1c248790657d5247463b1e1238fe074a3ae6e288..67a0ee797be36dc711820de845f855afc5ed4d84 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js
@@ -27,7 +27,7 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
this._editor.configureAutocomplete({
substituteRangeCallback: this._substituteRange.bind(this),
- suggestionsCallback: this._wordsWithPrefix.bind(this),
+ suggestionsCallback: this._wordsWithQuery.bind(this),
captureEnter: true
});
this._editor.widget().element.addEventListener('keydown', this._editorKeyDown.bind(this), true);
@@ -248,22 +248,21 @@ WebInspector.ConsolePrompt = class extends WebInspector.Widget {
}
/**
- * @param {!WebInspector.TextRange} prefixRange
+ * @param {!WebInspector.TextRange} queryRange
* @param {!WebInspector.TextRange} substituteRange
* @return {!Promise<!WebInspector.SuggestBox.Suggestions>}
*/
- _wordsWithPrefix(prefixRange, substituteRange) {
- var prefix = this._editor.text(prefixRange);
- var before = this._editor.text(new WebInspector.TextRange(0, 0, prefixRange.startLine, prefixRange.startColumn));
- var historyWords = this._historyCompletions(prefix);
- return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContext(before, prefix, true /* force */)
- .then(innerWordsWithPrefix);
-
+ _wordsWithQuery(queryRange, substituteRange) {
+ var query = this._editor.text(queryRange);
+ var before = this._editor.text(new WebInspector.TextRange(0, 0, queryRange.startLine, queryRange.startColumn));
+ var historyWords = this._historyCompletions(query);
+ return WebInspector.JavaScriptAutocomplete.completionsForTextInCurrentContext(before, query, true /* force */)
+ .then(innerWordsWithQuery);
/**
* @param {!Array<string>} words
* @return {!WebInspector.SuggestBox.Suggestions}
*/
- function innerWordsWithPrefix(words) {
+ function innerWordsWithQuery(words) {
return words.map(item => ({title: item})).concat(historyWords);
}
}

Powered by Google App Engine
This is Rietveld 408576698