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

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

Issue 2480423002: DevTools: Use CodeMirror syntax highlighting to improve JS autocomplete (Closed)
Patch Set: CurrentTokenType 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 a0516cc7f112be6588e2e4e6170857061f87361a..368d8388bac7f1b666d691a2e13fd54dd351c53a 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
@@ -110,11 +110,12 @@ WebInspector.TextEditorAutocompleteController = class {
* @param {!WebInspector.TextRange} queryRange
* @param {!WebInspector.TextRange} substituteRange
* @param {boolean=} force
+ * @param {string=} tokenType
* @return {!Promise.<!WebInspector.SuggestBox.Suggestions>}
*/
- _wordsWithQuery(queryRange, substituteRange, force) {
+ _wordsWithQuery(queryRange, substituteRange, force, tokenType) {
var external =
- this._config.suggestionsCallback ? this._config.suggestionsCallback(queryRange, substituteRange, force) : null;
+ this._config.suggestionsCallback ? this._config.suggestionsCallback(queryRange, substituteRange, force, tokenType) : null;
if (external)
return external;
@@ -233,8 +234,9 @@ WebInspector.TextEditorAutocompleteController = class {
var hadSuggestBox = false;
if (this._suggestBox)
hadSuggestBox = true;
-
- this._wordsWithQuery(queryRange, substituteRange, force).then(wordsAcquired.bind(this));
+ var token = this._textEditor.tokenAtTextPosition(substituteRange.startLine, substituteRange.startColumn);
+ var tokenType = (token && token.type) || '';
+ this._wordsWithQuery(queryRange, substituteRange, force, tokenType).then(wordsAcquired.bind(this));
/**
* @param {!WebInspector.SuggestBox.Suggestions} wordsWithQuery

Powered by Google App Engine
This is Rietveld 408576698