blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Respect LSP suggestion ordering

Open wonrax opened this issue 1 year ago • 1 comments

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 avatar Dec 15 '24 12:12 wonrax

This issue has largely been resolve with https://github.com/Saghen/blink.cmp/commit/76230d5a4a02cd1db8dec33b6eed0b4bc2dcbc53 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 avatar Dec 16 '24 17:12 saghen

Closing this since the sorting seems to be working well now

saghen avatar Jan 05 '25 00:01 saghen