Skip to content

Conversation

@eduardorittner
Copy link
Contributor

This is a small PR to get some eyeballs and hopefully some feedback on these changes. As #14566 rightfully points out, it's unintuitive that exact matches are shown last after all the partial matches.

I just did the most straightforward thing, which is to check if the pattern exactly matches the text, and give that a higher priority sort over anything else. It also seems natural to me to display smaller matches first, but I don't think this is that important.

Closes #14566

Note: I wanted to add tests for this but AFAICT there are no tests currently which exercise the sorting of completion items. I was going to add my own, but since the Completion struct takes an Editor, and I couldn't find any tests which actually initialized a whole Editor instance, I wasn't sure if this was the right approach.

@eduardorittner eduardorittner changed the title feat: prioritize exact and smaller matches feat: prioritize exact and smaller matches in completion Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve LSP auto-complete menu sorting

1 participant