BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.67k stars 217 forks source link

clojure-lsp snippet support #1483

Open Cyrik opened 2 years ago

Cyrik commented 2 years ago

clojure-lsp already has snippet support, but they aren't showing up in Calva. The code for them is here. Apparently, Calva still has to register those per the docs

I haven't looked at the Calva -> LSP integration yet, so someone else would probably get this done faster.

PEZ commented 2 years ago

I think it would be good if you did this when you find some time, @Cyrik. Rationale is that it is good that more people know stuff about how the integration to lsp works. And you in particular, since you are looking at many different aspects Calva.

We could do it together, of course. I happen to have some time tomorrow during CET work hours. Don't know how that suits you.

bpringe commented 2 years ago

The place to look (for whoever is interested) is in lsp/main.ts.

Cyrik commented 2 years ago

Puh found it, only took me forever! Turns out that for some reason vscode really likes getting the snippet info twice. textDocument/completion already returns the snippets and provides the snippet part in insertText. Once you select the completion vscode sends completionItem/resolve to the server to get the info again and this time LSP doesn't provide the snippet part. We could fix this in Calva, but that would be more complicated and would move us away from a default implementation.

@ericdallo Could you provide the full CompletionItem in the completionResolve response? I can create an issue if you want or try to build a PR.

ericdallo commented 2 years ago

Yes @Cyrik, this probably should be solved on clojure-lsp side, we should return the completion item receive with extra info that we should add, not remove anything. Please open an issue on clojure-lsp side and feel free to give a try on the PR if you want, LMK if any questions