Commit 1a7fe92e authored by einbinder's avatar einbinder Committed by Commit bot

DevTools: Don't show autocomplete when the user is typing a number

Any time the user typed 3, we would show a suggestion for Float32Array.

BUG=660941

Review-Url: https://codereview.chromium.org/2479943002
Cr-Commit-Position: refs/heads/master@{#430157}
parent 97c2c584
...@@ -39,4 +39,12 @@ Found: NodeList ...@@ -39,4 +39,12 @@ Found: NodeList
Found: AudioNode Found: AudioNode
Found: GainNode Found: GainNode
Checking '32'
Not Found: Float32Array
Not Found: Int32Array
Checking 'window.32'
Found: Float32Array
Found: Int32Array
...@@ -49,7 +49,9 @@ function test() ...@@ -49,7 +49,9 @@ function test()
() => testCompletions("templateString`asdf`", "should", ["shouldNotFindThis"]), () => testCompletions("templateString`asdf`", "should", ["shouldNotFindThis"]),
() => testCompletions("window.document.", "BODY", ["body"]), () => testCompletions("window.document.", "BODY", ["body"]),
() => testCompletions("window.", "dOcUmE", ["document"]), () => testCompletions("window.", "dOcUmE", ["document"]),
() => testCompletions("window.", "node", ["NodeList", "AudioNode", "GainNode"]) () => testCompletions("window.", "node", ["NodeList", "AudioNode", "GainNode"]),
() => testCompletions("", "32", ["Float32Array", "Int32Array"]),
() => testCompletions("window.", "32", ["Float32Array", "Int32Array"])
]).then(InspectorTest.completeTest); ]).then(InspectorTest.completeTest);
} }
......
...@@ -74,7 +74,7 @@ WebInspector.JavaScriptAutocomplete.completionsForExpression = function(expressi ...@@ -74,7 +74,7 @@ WebInspector.JavaScriptAutocomplete.completionsForExpression = function(expressi
expressionString = expressionString.substr(0, lastIndex); expressionString = expressionString.substr(0, lastIndex);
// User is entering float value, do not suggest anything. // User is entering float value, do not suggest anything.
if (expressionString && !isNaN(expressionString)) if ((expressionString && !isNaN(expressionString)) || (!expressionString && query && !isNaN(query)))
return Promise.resolve([]); return Promise.resolve([]);
if (!query && !expressionString && !force) if (!query && !expressionString && !force)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment