zed icon indicating copy to clipboard operation
zed copied to clipboard

Improve completion menu sorting

Open XDeme1 opened this issue 2 months ago • 4 comments

Release Notes:

  • Improved Sorting of words in the completion menu.

Fixed #9342 This fixes the issue by making two things.

  1. Ordering first by exact match, lsp sorted text, matching index and then matching cases.
  2. 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

XDeme1 avatar Apr 08 '24 17:04 XDeme1

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?

osiewicz avatar Apr 12 '24 13:04 osiewicz

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

XDeme1 avatar Apr 12 '24 14:04 XDeme1

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 ;)

osiewicz avatar Apr 12 '24 15:04 osiewicz

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 like self.s_word, self.word and self.word_dictionary gives priority to self.s_word

https://github.com/zed-industries/zed/assets/66138117/98e50387-2225-4c04-ab1a-736eac43e6af

XDeme1 avatar Apr 12 '24 16:04 XDeme1