Autocomplete result matching the input should be first
Categories
(DevTools :: Console, defect, P3)
Tracking
(firefox68 fixed)
| Tracking | Status | |
|---|---|---|
| firefox68 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: toms, Mentored)
References
Details
Attachments
(1 file)
| Reporter | ||
Comment 3•7 years ago
|
||
Hello Tom, sure you can! Thanks for asking :)
It looks like you're new to Bugzilla, so maybe it's your first bug. If it's not, you can jump to the end to see where the issue is.
I suggest you to read https://docs.firefox-dev.tools/getting-started/ , it will help you setting up the work environment for devtools. When asked, remember to use Artifact Builds.
Also, since the work will happen on the server, if you want to use the debugger, you will have to use the Browser Content Toolbox.
So most of the work should happen in devtools/server/actors/webconsole.js. Here, we are changing the order to display lowercased item first. We should also check that if one item in the list equals matchProp, it should be displayed first.
Then we'll have to add a test to make sure this work as intended.
If you have any questions or struggles, don't hesitate to ask here, or directly in Slack.
| Assignee | ||
Comment 4•7 years ago
|
||
Ok thanks. Looking at this, there seems to be some conflict with the sorting of the lowercase items first. It's already been sorted to display "document" before "Document." But it also displays "dispatchEvent" before "Directory", "updateCommands" before "UIEvent" and so on.
| Assignee | ||
Comment 5•7 years ago
|
||
So the existing code that sorted items beginning with lowercase letters first was causing that behavior. I got rid of it which fixed that issue and this bug also seems to be fixed.
| Reporter | ||
Comment 6•7 years ago
|
||
(In reply to TomS [:toms] from comment #5)
So the existing code that sorted items beginning with lowercase letters first was causing that behavior. I got rid of it which fixed that issue and this bug also seems to be fixed.
TomS, we do want to have lowercased items first. The reasoning is that if you type docume, you probably want document, and not Document.
Here's an example of what the sort function could look like: https://jsbin.com/vijililudo/edit?js,output
| Assignee | ||
Comment 7•7 years ago
|
||
I know what you mean. The lowercase items are naturally showing up first. These are examples of the results I'm getting now
| Assignee | ||
Comment 8•7 years ago
|
||
(In reply to Nicolas Chevobbe from comment #6)
TomS, we do want to have lowercased items first. The reasoning is that if you type
docume, you probably wantdocument, and notDocument.Here's an example of what the sort function could look like: https://jsbin.com/vijililudo/edit?js,output
That type of function sorts the matches in the way you described but only if the expression is typed out in full. Starting with "sty" etc still sorts the matches in the wrong way: https://imgur.com/a/2pRi7tV
I might have solved the first part by sorting them with lowercase items first but I'm just having some trouble now implementing the sort by perfect match
matches = Array.from(matches).sort((a, b) => {
if (a[0] === a[0].toLocaleLowerCase() && b[0] === b[0].toLocaleLowerCase() ||
a[0] === a[0].toLocaleUpperCase() && b[0] === b[0].toLocaleUpperCase()) {
return a.localeCompare(b);
}
if (a[0] === a[0].toLocaleLowerCase()) {
return -1;
}
return 1;
});
}
return {
from: this.actorID,
matches,
matchProp,
isElementAccess: isElementAccess === true,
};
},
Or if I'm way off here let me know
| Assignee | ||
Comment 9•7 years ago
|
||
The autocomplete popup in the web console now favours matches
with the user input in alphabetical order with lowercase letters and
perfect matches brought to the top of the list.
e.g.
Typing 'document.styleSheets' brings up the result:
-styleSheets
-styleSheetSets
| Reporter | ||
Comment 10•7 years ago
|
||
Hello Tom, is there anything blocking you for this bug?
| Assignee | ||
Comment 11•7 years ago
|
||
(In reply to Nicolas Chevobbe from comment #10)
Hello Tom, is there anything blocking you for this bug?
Sorry for the delay. I just sent a revision
Updated•7 years ago
|
Updated•7 years ago
|
Comment 12•7 years ago
|
||
Comment 13•7 years ago
|
||
| bugherder | ||
Description
•