lua: simple snippet support in the completion items (#12118)

Old behavior is: foo(${placeholder: bar, ...)

with lots of random garbage you'd never want inserted.

New behavior is: foo(bar, baz) 

(which maybe is good, maybe is bad [depends on user], but definitely better than it was).

-----

* Implement rudimentary snippet parsing

Add support for parsing and discarding snippet tokens from the completion items.

Fixes #11982

* Enable snippet support

* Functional tests for snippet parsing

Add simplified real-world snippet text examples to the completion items
test

* Add a test for nested snippet tokens

* Remove TODO comment

* Return the unmodified item if the format is plain text

* Add a plain text completion item
This commit is contained in:
Viktor Kojouharov
2020-05-28 14:31:56 +02:00
committed by GitHub
parent 2ca8f02a64
commit 5a9226c800
3 changed files with 83 additions and 5 deletions

View File

@@ -633,8 +633,7 @@ function protocol.make_client_capabilities()
dynamicRegistration = false;
completionItem = {
-- TODO(tjdevries): Is it possible to implement this in plain lua?
snippetSupport = false;
snippetSupport = true;
commitCharactersSupport = false;
preselectSupport = false;
deprecatedSupport = false;