Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect LSP suggestion ordering #570

Open
wonrax opened this issue Dec 15, 2024 · 1 comment · May be fixed by #593
Open

Respect LSP suggestion ordering #570

wonrax opened this issue Dec 15, 2024 · 1 comment · May be fixed by #593
Labels
feature New feature or request fuzzy Filtering and sorting of completion items

Comments

@wonrax
Copy link

wonrax commented Dec 15, 2024

Feature Description

Currently, blink doesn't seem to respect LSP suggestion ordering, defaulting to sorting by kind or label even when disabled in the config. This affects heuristic LSP suggestion ordering, such as enum variant suggestions within match blocks as demonstrated below.

VsCode:
image

Zed:
image

Blink:
image

My blink config:

opts = {
  fuzzy = {
    use_frecency = false,
    use_proximity = false,
    sort = {},
  },
}

My questions are:

  1. How can I preserve LSP suggestion ordering as an end user?

  2. Could we make LSP suggestion ordering the default behavior for blink.cmp? For reference, Zed implements this using a hybrid approach:

    // We do want to strike a balance here between what the language server tells us
    // to sort by (the sort_text) and what are "obvious" good matches (i.e. when you type
    // `Creat` and there is a local variable called `CreateComponent`).
    // So what we do is: we bucket all matches into two buckets
    // - Strong matches
    // - Weak matches
    // Strong matches are the ones with a high fuzzy-matcher score (the "obvious" matches)
    // and the Weak matches are the rest.
    //
    // For the strong matches, we sort by our fuzzy-finder score first and for the weak
    // matches, we prefer language-server sort_text first.
    //
    // The thinking behind that: we want to show strong matches first in order of relevance(fuzzy score).
    // Rest of the matches(weak) can be sorted as language-server expects.
    
@wonrax wonrax added the feature New feature or request label Dec 15, 2024
@Saghen Saghen closed this as completed in 76230d5 Dec 16, 2024
@Saghen Saghen reopened this Dec 16, 2024
@Saghen Saghen linked a pull request Dec 16, 2024 that will close this issue
3 tasks
@Saghen
Copy link
Owner

Saghen commented Dec 16, 2024

This issue has largely been resolve with 76230d5 but the Zed hybrid sort seems quite interesting. I don't have the time to work on it right now, but I've thrown up a draft PR for anyone interested in working on the sorting. You can open a PR against that branch

@Saghen Saghen added the fuzzy Filtering and sorting of completion items label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fuzzy Filtering and sorting of completion items
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants