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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js

Issue 2471243002: DevTools: Consolidate completion code into JavaScriptAutocomplete.js (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/components/ExecutionContextSelector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
index 6f6205cf48c08a62fac5f1dc3abbe0ed5814d233..ee2b485db90dbee365cbd8cb23f494cb1672b159 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
@@ -29,59 +29,6 @@ WebInspector.ExecutionContextSelector = class {
}
/**
- * @param {!Element} proxyElement
- * @param {!Range} wordRange
- * @param {boolean} force
- * @param {function(!Array.<string>, number=)} completionsReadyCallback
- */
- static completionsForTextPromptInCurrentContext(proxyElement, wordRange, force, completionsReadyCallback) {
- var expressionRange = wordRange.cloneRange();
- expressionRange.collapse(true);
- expressionRange.setStartBefore(proxyElement);
- WebInspector.ExecutionContextSelector
- .completionsForTextInCurrentContext(expressionRange.toString(), wordRange.toString(), force)
- .then(completionsReadyCallback);
- }
-
- /**
- * @param {string} text
- * @param {string} completionsPrefix
- * @param {boolean=} force
- * @return {!Promise<!Array<string>>}
- */
- static completionsForTextInCurrentContext(text, completionsPrefix, force) {
- var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
- if (!executionContext)
- return Promise.resolve([]);
- var index;
- var stopChars = new Set(' =:({;,!+-*/&|^<>`'.split(''));
- for (index = text.length - 1; index >= 0; index--) {
- // Pass less stop characters to rangeOfWord so the range will be a more complete expression.
- if (stopChars.has(text.charAt(index)))
- break;
- }
- var clippedExpression = text.substring(index + 1);
- var bracketCount = 0;
-
- index = clippedExpression.length - 1;
- while (index >= 0) {
- var character = clippedExpression.charAt(index);
- if (character === ']')
- bracketCount++;
- // Allow an open bracket at the end for property completion.
- if (character === '[' && index < clippedExpression.length - 1) {
- bracketCount--;
- if (bracketCount < 0)
- break;
- }
- index--;
- }
- clippedExpression = clippedExpression.substring(index + 1);
-
- return executionContext.completionsForExpression(clippedExpression, completionsPrefix, force);
- }
-
- /**
* @override
* @param {!WebInspector.Target} target
*/

Powered by Google App Engine
This is Rietveld 408576698