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

Unified Diff: third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js

Issue 2478923003: DevTools: Distinguish between forced and unforced autocomplete in CMTE (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
index 080f19026187604515529810444725c7929d97cb..a0516cc7f112be6588e2e4e6170857061f87361a 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
@@ -109,15 +109,16 @@ WebInspector.TextEditorAutocompleteController = class {
/**
* @param {!WebInspector.TextRange} queryRange
* @param {!WebInspector.TextRange} substituteRange
+ * @param {boolean=} force
* @return {!Promise.<!WebInspector.SuggestBox.Suggestions>}
*/
- _wordsWithQuery(queryRange, substituteRange) {
+ _wordsWithQuery(queryRange, substituteRange, force) {
var external =
- this._config.suggestionsCallback ? this._config.suggestionsCallback(queryRange, substituteRange) : null;
+ this._config.suggestionsCallback ? this._config.suggestionsCallback(queryRange, substituteRange, force) : null;
if (external)
return external;
- if (!this._dictionary || queryRange.startColumn === queryRange.endColumn)
+ if (!this._dictionary || (!force && queryRange.isEmpty()))
return Promise.resolve([]);
var completions = this._dictionary.wordsWithPrefix(this._textEditor.text(queryRange));
@@ -209,7 +210,10 @@ WebInspector.TextEditorAutocompleteController = class {
return true;
}
- autocomplete() {
+ /**
+ * @param {boolean=} force
+ */
+ autocomplete(force) {
this._initializeIfNeeded();
if (this._codeMirror.somethingSelected()) {
this.clearAutocomplete();
@@ -230,7 +234,7 @@ WebInspector.TextEditorAutocompleteController = class {
if (this._suggestBox)
hadSuggestBox = true;
- this._wordsWithQuery(queryRange, substituteRange).then(wordsAcquired.bind(this));
+ this._wordsWithQuery(queryRange, substituteRange, force).then(wordsAcquired.bind(this));
/**
* @param {!WebInspector.SuggestBox.Suggestions} wordsWithQuery

Powered by Google App Engine
This is Rietveld 408576698