zed
zed copied to clipboard
Improve completion menu sorting
Release Notes:
- Improved Sorting of words in the completion menu.
Fixed #9342 This fixes the issue by making two things.
- Ordering first by exact match, lsp sorted text, matching index and then matching cases.
- Removed Strong and Weak buckets, because short matches would fall into the strong bucket first and would result in an inaccurate match.
https://github.com/zed-industries/zed/assets/66138117/bd6fc6a9-57dc-48d0-b2b6-02be9fbd9fd5
Hey, It looks like we have quite a bit of custom logic there + this PR removes our reliance on fuzzy matcher altogether, which I'm not sure of. I've tried to improve our fuzzy matcher instead (by switching out an underlying implementation) in https://github.com/zed-industries/zed/commit/7ef31f25445d045f0cc69df5b44b62731994afd6 - would you mind giving that a run to see whether you like the completions provided on that branch?
Thanks for this patch @osiewicz, it improves the results a lot. Only problem I've found is with a default Nextjs project:
https://github.com/zed-industries/zed/assets/66138117/a05ce146-4da7-4d58-8a80-4c91fdf2ca30
Oh, right, it looks like I should've updated the weak/strong match threshold as well. I've actually removed the distinction and the fuzzy score should now be prefered to LSP score. Give it a try ;)
Its a lot better now, one last thing.
- Exact matches are not the first match
https://github.com/zed-industries/zed/assets/66138117/fe4f4aff-5f11-4e9c-8cd4-ba48e984b018
This one i am not sure if is a problem:
- Typing
word
with matches likeself.s_word
,self.word
andself.word_dictionary
gives priority toself.s_word
https://github.com/zed-industries/zed/assets/66138117/98e50387-2225-4c04-ab1a-736eac43e6af
From the comments here, it seems that this PR has been superseded by other work. I'm going to close this PR, but if there's valuable functionality to include, feel free to open another PR for this. Perhaps to fix that exact match issue?