From a4cf75503e0de2b1b589c7312682a96d785bec89 Mon Sep 17 00:00:00 2001 From: Oleksiy Hryshchenko Date: Mon, 3 Apr 2023 11:12:04 +0300 Subject: [PATCH] ultisnip option init --- autoload/lsp/completion.vim | 32 +++++++++++++++----------------- autoload/lsp/options.vim | 2 ++ doc/lsp.txt | 3 +++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 725d07e..98fbe90 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -88,19 +88,21 @@ export def CompletionReply(lspserver: dict, cItems: any) 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('.') @@ -204,10 +206,6 @@ export def CompletionReply(lspserver: dict, cItems: any) endif endif - if item->has_key('info') - d.menu = item.info - endif - d.user_data = item completeItems->add(d) endfor diff --git a/autoload/lsp/options.vim b/autoload/lsp/options.vim index 3d6d10c..b3b8dfb 100644 --- a/autoload/lsp/options.vim +++ b/autoload/lsp/options.vim @@ -54,6 +54,8 @@ export var lspOptions: dict = { 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 384f3c9..0521124 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -358,6 +358,9 @@ showSignature |Boolean| option. In insert mode, automatically show 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. -- 2.48.1