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

Add streaming (partial results) support

Open jheroy opened this issue 11 months ago • 12 comments
trafficstars

Feature Description

Doc https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#partialResultParams Why need this: https://github.com/golang/go/issues/69631

jheroy avatar Nov 28 '24 08:11 jheroy

Do you know of any LSPs that support this? I'm looking for something I can test against

saghen avatar Dec 06 '24 17:12 saghen

It looks like haskell might based on a preliminary search? https://grep.app/search?q=partialResultToken&filter[repo][0]=haskell/lsp Although this might be from the lsp spec haskell package, not the lsp itself

Ada might as well https://grep.app/search?q=partialResultToken&filter[repo][0]=AdaCore/ada_language_server

Or rosalyn for C#/dotnet/whatever https://grep.app/search?q=partialResultToken&filter[repo][0]=dotnet/roslyn

stefanboca avatar Dec 06 '24 23:12 stefanboca

Do you know of any LSPs that support this? I'm looking for something I can test against

gopls support this

jheroy avatar Dec 08 '24 08:12 jheroy

Any idea how sorting results could be implemented? It seems like getting new results requires re-sorting all the results to get the correct sort order.

I guess it might be possible to batch the sorts at a specific interval, for example.

mikavilpas avatar Dec 08 '24 13:12 mikavilpas

Is it possible to insert results into the correct sorted position, thus always maintaining a correctly sorted list? I'm not sure how sorting is implemented, though, so this might be difficult, especially if the sorting algorithm isn't stable.

The insertions themselves could be batched at a specific interval to avoid repeatedly extending the list by one element.

Or maybe sorting could be done on the fly, as the completion window is scrolled? We only need as much of the list sorted as is visible. Although this might not be viable when wrapping around backwards from the top of the list to the bottom.

stefanboca avatar Dec 08 '24 17:12 stefanboca

gopls support this

It returns JSON RPC method not found: "Progress" not yet implemented so it seems like they don't support it on v0.16.2. Seems like roslyn doesn't support it either

saghen avatar Dec 10 '24 19:12 saghen

Putting this into the backlog until I'm able to find an LSP that supports it

saghen avatar Dec 10 '24 19:12 saghen

I think clangd support partial results.

xzbdmw avatar Dec 12 '24 14:12 xzbdmw

I did some research (mainly for myself, please ignore if not useful):

  • basic chatgpt explanation of how lsp defines this feature https://chatgpt.com/share/675aff7d-8da4-800e-8750-bbdd2b917b8b
  • I tried to look how nvim-cmp implements it, but I don't think it does. There is a feature request here https://github.com/hrsh7th/nvim-cmp/issues/2101, might be useful to subscribe in order to get notified if it's implemented (to compare implementations)

Ran a bit out of time right now, but I can maybe look at clangd and see if streaming is supported.

mikavilpas avatar Dec 12 '24 15:12 mikavilpas

Ahh, I misunderstood, it sounds like the server sends the notifications to the client directly. I'll take another peak

Edit: Still not able to find a server that supports it

saghen avatar Dec 12 '24 15:12 saghen

Fyi @mikavilpas you can already stream results to blink by calling the callback function multiple times. After the first callback, the results will be shown, and subsequent callbacks will be appended to the list

saghen avatar Feb 10 '25 16:02 saghen

Oh that's super cool, thanks for the heads up! I'll try it out.

mikavilpas avatar Feb 10 '25 17:02 mikavilpas