blink.cmp
blink.cmp copied to clipboard
Add streaming (partial results) support
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
Do you know of any LSPs that support this? I'm looking for something I can test against
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
Do you know of any LSPs that support this? I'm looking for something I can test against
gopls support this
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.
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.
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
Putting this into the backlog until I'm able to find an LSP that supports it
I think clangd support partial results.
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.
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
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
Oh that's super cool, thanks for the heads up! I'll try it out.