mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
f9b5460bf2
This patch adds a smarter heuristic for autocompletion results: if the input first letter is lowercased, then we'll filter matching properties case insensitively. But if the user starts with an uppercase, we assume they know the property they want and thus respect the casing. For example: `win` will return both `window` and `Window`, but `Win` will return `Window` only. Due to this behavior, we change the order of the autocomplete results so lowercased property are displayed before the uppercased one. If we take are example again, it's likely that if a user type `win`, they want `window`, but the alphabetical order would return `Window` first which would annoy user. Now, since we return results that does not match exactly the user input, we need to modify the frontend. Usually, we only show the autocompletion popup if there are at least 2 matching items, since 1 matching item will still be displayed using the autocompletion text. But now, since the input might not match, we want to still display the popup if there is one matching item, but starts differentely than what the user entered. For example, the user typed `window.addeve`, which matches `addEventListener`. The completion text will make it looks like it will be completed to `window.addeventListener`, which would be undefined. So showing the popup with the actual matching property might avoid some confusion for the user. A test was added to make sure the frontend works as expected. Some test cases were added in the server test to make sure the actor returns expected results. Other tests needed some adjustement because of the insensitive case matches and the new order of results. Differential Revision: https://phabricator.services.mozilla.com/D4061 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
test | ||
client.js | ||
js-property-provider.js | ||
moz.build | ||
network-helper.js | ||
throttle.js |