dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.53k stars 1.43k forks source link

LSP snippet support? #1821

Open suo opened 6 years ago

suo commented 6 years ago

The Language Server Protocol supports snippets for function arguments (among other things). Is there any plan to add support for this to the LSP completion in ALE?

w0rp commented 6 years ago

Maybe, I'm not sure it's worth it. I use https://github.com/garbas/vim-snipmate and there are a few other similar Vim snippet plugins. I think snippets are better written in Vim, because then you can control where the cursor lands in multiple places, and you can evaluate Vim expressions. One area where an LSP snippet might be better is for overriding a method defined in a superclass or something, though I think filling in methods might work better as a "quick fix" action.

paulreimer commented 5 years ago

I would just like to note that I think the LSP snippets are a different use-case from a typical snippets plugin.

(at least with coc.vim plugin) LSP automatically generates a custom "snippet" for ALL functions, so when you trigger the completion of the function name, you get a snippet with the arguments -- including multiple cursor spots as you say. It is like completion, but turbocharged (you can cycle through the function arguments easily, like a snippet!).

I use a snippet plugin also, but for a different use-case (the kind you write yourself to save typing).

Personally I think ALE should support the LSP provided snippets, and consider it an "improved completion experience" ("snippets" is confusing, although the completion flow is the same).

paulreimer commented 5 years ago

@w0rp Here is an example of the flow from coc.vim: https://user-images.githubusercontent.com/251450/52922829-23614e00-335f-11e9-8d33-3dae30ea4a9a.gif

w0rp commented 5 years ago

Okay, someone else can implement this.

cpiber commented 2 years ago

Correct me if I'm wrong, but with neosnippet.vim active it should already work; at least with texlab I can just use to expand the snippet, while accepts the suggestion as-is.