autoload/lsp/completion.vim | 32 +++++++++++++++----------------- autoload/lsp/options.vim | 2 ++ doc/lsp.txt | 3 +++ diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 725d07e355a39873e78baab09ec09f21ae827d92..98fbe90af0d11aa07262a1700aefcdcea4e2f13b 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -88,19 +88,21 @@ items = cItems.items lspserver.completeItemsIsIncomplete = cItems.isIncomplete endif - var ultisniplist = UltiSnips#SnippetsInCurrentScope() - - for [key, info] in items(ultisniplist) - echom key - items->add({ - label: key, - data: { - entryNames: [key], - }, - kind: 15, - info: info, - }) - endfor + if opt.lspOptions.ultisnipsSupport + var ultisniplist = UltiSnips#SnippetsInCurrentScope() + for [key, info] in items(ultisniplist) + items->add({ + label: key, + data: { + #file: '/home/olex/TMP/test/test.js', + entryNames: [key], + }, + kind: 15, + #detail: info, + documentation: info, + }) + endfor + endif # Get the keyword prefix before the current cursor column. var chcol = charcol('.') @@ -202,10 +204,6 @@ && item.documentation.value->type() == v:t_string d.info = item.documentation.value endif endif - endif - - if item->has_key('info') - d.menu = item.info endif d.user_data = item diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 3d6d10cce1ae9f769c29959066f0d547c97acf52..b3b8dfbff13c4ce7e4cde8443695f10d8bd5b2d9 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -54,6 +54,8 @@ # In insert mode, show the current symbol signature automatically showSignature: true, # enable snippet completion support snippetSupport: false, + # enable SirVer/ultisnips completion support + ultisnipsSupport: false, # Use a floating menu to show the code action menu instead of asking for input usePopupInCodeAction: false, # ShowReferences in a quickfix list instead of a location list` diff --git a/doc/lsp.txt b/doc/lsp.txt index 384f3c9fd42e927a1250af01424547c9a41f5759..0521124335ba93f6058bcd2410211248d14dd55c 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -358,6 +358,9 @@ By default this is set to true. snippetSupport |Boolean| option. Enable snippet completion support. Need a snippet completion plugin like vim-vsnip. By default this is set to false. +ultisnipsSupport |Boolean| option. Enable SirVer/ultisnips support. + Need a snippet completion plugin SirVer/ultisnips. + By default this is set to false. usePopupInCodeAction |Boolean| option. When using the |:LspCodeAction| command to display the code action for the current line, use a popup menu instead of echoing.