-
Notifications
You must be signed in to change notification settings - Fork 298
De-deduplicate completion items + improve sorting #2638
De-deduplicate completion items + improve sorting #2638
Conversation
* Remove completion items that are duplicates for all attributes other than `sortText` (which is always different but is just some machine-readable hash for sorting by). * Continue to sort abbreviations below full matches. * Sort matching `filterText`/`labels` so they appear next to each other. * Otherwise use `sortText` given by the language server.
The main motivation for this PR was to remove the duplicates coming back from However, I found that the sort order of results was odd (which makes filtering duplicates more expensive, and just looks strange). Perhaps they make some sense straight from the language server, but Oni then filters as the user types, so retaining the sort order from the language server makes even less sense. Hence why I thought it reasonable to "fix" the sort order for filtered completions. |
@@ -3,6 +3,7 @@ | |||
* | |||
* Selectors are functions that take a state and derive a value from it. | |||
*/ | |||
import * as _ from "lodash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feltech if you import just the specific functions you need rather than _
from lodash this will help reduce our bundle size which is something we should aim for but probably don't get right in many situations
e.g.
import uniq from "lodash/uniq"
// or if type issues
import * as omit from "lodash/omit"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Done.
Codecov Report
@@ Coverage Diff @@
## master #2638 +/- ##
==========================================
+ Coverage 45.43% 45.51% +0.07%
==========================================
Files 361 361
Lines 14563 14591 +28
Branches 1912 1919 +7
==========================================
+ Hits 6617 6641 +24
- Misses 7721 7723 +2
- Partials 225 227 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍looks good now with all tests passing thanks for the contribution @feltech
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good thanks for the contribution @feltech 👍
cquery
(C++) completions.filterText
/labels
so they appear next to each other.sortText
given by the language server.