Skip to content

Commit

Permalink
DevTools: Console: More accurate autocomplete after a bracket
Browse files Browse the repository at this point in the history
BUG=506061

Review-Url: https://codereview.chromium.org/2557433006
Cr-Commit-Position: refs/heads/master@{#437169}
  • Loading branch information
JoelEinbinder authored and Commit bot committed Dec 8, 2016
1 parent 30de111 commit 8d4dcd6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion front_end/components/JavaScriptAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Components.JavaScriptAutocomplete.completionsForExpression = function(expression
if ((expressionString && !isNaN(expressionString)) || (!expressionString && query && !isNaN(query)))
return Promise.resolve([]);

// User is creating an array, do not suggest anything.
if (bracketNotation && !expressionString)
return Promise.resolve([]);

if (!query && !expressionString && !force)
return Promise.resolve([]);

Expand Down Expand Up @@ -252,7 +256,7 @@ Components.JavaScriptAutocomplete._completionsForQuery = function(
var property = properties[i];

// Assume that all non-ASCII characters are letters and thus can be used as part of identifier.
if (dotNotation && !/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
if (!bracketNotation && !/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
continue;

if (bracketNotation) {
Expand Down

0 comments on commit 8d4dcd6

Please sign in to comment.