Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/components/JavaScriptAutocomplete.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/components/JavaScriptAutocomplete.js b/third_party/WebKit/Source/devtools/front_end/components/JavaScriptAutocomplete.js |
| index f07ebc27333e272e9755076134a797a8afd39d37..718a594ec2370eb385e7d9a2f2b5b9db5866cdf9 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/JavaScriptAutocomplete.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/JavaScriptAutocomplete.js |
| @@ -244,7 +244,10 @@ WebInspector.JavaScriptAutocomplete._completionsForPrefix = function(dotNotation |
| var quoteUsed = '"'; |
| } |
| - var results = []; |
| + var caseSensitivePrefix = []; |
|
lushnikov
2016/11/03 22:06:51
let's move this to where we use these
einbinder
2016/11/03 23:12:14
Done.
|
| + var caseInsensitivePrefix = []; |
| + var caseSensitiveAnywhere = []; |
| + var caseInsensitiveAnywhere = []; |
| if (!expressionString) { |
| const keywords = [ |
| @@ -272,11 +275,19 @@ WebInspector.JavaScriptAutocomplete._completionsForPrefix = function(dotNotation |
| if (property.length < prefix.length) |
| continue; |
| - if (prefix.length && !property.startsWith(prefix)) |
| + if (prefix.length && property.toLowerCase().indexOf(prefix.toLowerCase()) === -1) |
| continue; |
| - |
| // Substitute actual newlines with newline characters. @see crbug.com/498421 |
| - results.push(property.split('\n').join('\\n')); |
| + var prop = property.split('\n').join('\\n'); |
| + |
| + if (property.startsWith(prefix)) |
| + caseSensitivePrefix.push(prop); |
| + else if (property.toLowerCase().startsWith(prefix.toLowerCase())) |
| + caseInsensitivePrefix.push(prop); |
| + else if (property.indexOf(prefix) !== -1) |
| + caseSensitiveAnywhere.push(prop); |
| + else |
| + caseInsensitiveAnywhere.push(prop); |
| } |
|
lushnikov
2016/11/03 22:06:51
I'm not convinced about JS case-insensetive autoco
einbinder
2016/11/03 23:12:14
Yay!
|
| - return results; |
| + return caseSensitivePrefix.concat(caseInsensitivePrefix).concat(caseSensitiveAnywhere).concat(caseInsensitiveAnywhere); |
| }; |