Modified: trunk/Source/WebInspectorUI/ChangeLog (176323 => 176324)
--- trunk/Source/WebInspectorUI/ChangeLog 2014-11-19 18:27:33 UTC (rev 176323)
+++ trunk/Source/WebInspectorUI/ChangeLog 2014-11-19 18:32:30 UTC (rev 176324)
@@ -1 +1,13 @@
+2014-11-19 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Improve basic _javascript_ completion in inline <script>s
+ https://bugs.webkit.org/show_bug.cgi?id=138845
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Controllers/CodeMirrorCompletionController.js:
+ (WebInspector.CodeMirrorCompletionController.prototype._generateJavaScriptCompletions):
+ Fix up CodeMirror mode handling for _javascript_ completion when inside of mixed mode
+ input (html). Also add completion for CodeMirror's localVars list.
+
== Rolled over to ChangeLog-2014-11-19 ==
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js (176323 => 176324)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js 2014-11-19 18:27:33 UTC (rev 176323)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js 2014-11-19 18:32:30 UTC (rev 176324)
@@ -574,12 +574,14 @@
const prefix = this._prefix;
- const declaringVariable = mainToken.state.lexical.type === "vardef";
- const insideSwitch = mainToken.state.lexical.prev ? mainToken.state.lexical.prev.info === "switch" : false;
- const insideBlock = mainToken.state.lexical.prev ? mainToken.state.lexical.prev.type === "}" : false;
- const insideParenthesis = mainToken.state.lexical.type === ")";
- const insideBrackets = mainToken.state.lexical.type === "]";
+ var localState = mainToken.state.localState ? mainToken.state.localState : mainToken.state;
+ const declaringVariable = localState.lexical.type === "vardef";
+ const insideSwitch = localState.lexical.prev ? localState.lexical.prev.info === "switch" : false;
+ const insideBlock = localState.lexical.prev ? localState.lexical.prev.type === "}" : false;
+ const insideParenthesis = localState.lexical.type === ")";
+ const insideBrackets = localState.lexical.type === "]";
+
const allKeywords = ["break", "case", "catch", "const", "continue", "debugger", "default", "delete", "do", "else", "false", "finally", "for", "function", "if", "in",
"Infinity", "instanceof", "NaN", "new", "null", "return", "switch", "this", "throw", "true", "try", "typeof", "undefined", "var", "void", "while", "with"];
const valueKeywords = ["false", "Infinity", "NaN", "null", "this", "true", "undefined"];
@@ -622,13 +624,17 @@
}
}
- var context = mainToken.state.context;
+ var context = localState.context;
while (context) {
- filterVariables(context.vars);
+ if (context.vars)
+ filterVariables(context.vars);
context = context.prev;
}
- filterVariables(mainToken.state.globalVars);
+ if (localState.localVars)
+ filterVariables(localState.localVars);
+ if (localState.globalVars)
+ filterVariables(localState.globalVars);
}
switch (suffix.substring(0, 1)) {