Open roxma opened 7 years ago
This is something I've wanted to do for a long time actually. I think using a pop up completion menu would be a lot simpler than the current multisnip method, and it'd remove the tlib dependency. I've just been struggling finding time for SnipMate as I started a new job not too long ago. Hopefully I can find some time this Labor Day at the latest.
I'm the author of asyncomplete.vim and vim-lsp. I would also be very much interested in this.
Hi, I'm the author of nvim-completion-manager (NCM)
Currently NCM uses snipmate for function parameter expansion, and snippets expansions from language server
My current approach is quite hacky
In short, NCM injects the snippet into snipmate. And it remembers to cleanup the injected snippet afterwards.
As discussed in https://github.com/Shougo/neosnippet.vim/issues/398#issuecomment-326472600
This approach has some disavantages.
The point where ncm removes the injected snippet is not elegant, yet, I haven't seen the use case where this approach fails.Here's my proposal:
Things would be a lot easier if a common convension is set up so that snippet engines recognize the
v:completed_item.snippet
andv:completed_item.snippet_trigger
.The
snippet_trigger
is useful, for example, in ncm, the popup menu looks like this when there's a file nameddatetime.noww
. A more complicated situation would be non-parameter-expansion snippets.The completion items are
Notice that the
now
method is left-padded withdatetime.
to be merged with the items from filepath completion. Withoutsnippet_trigger
, the engine may not be able to know it should replacenow
instead ofdatetime.now
.This is also related to https://github.com/neovim/neovim/issues/7179, since vim doesn't forward custom field name like
snippet
andsnippet_trigger
. Currently ncm also uses some dirty hack to get this to work.