]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
ultisnip option init
authorOleksiy Hryshchenko <greeschenko@gmail.com>
Mon, 3 Apr 2023 08:12:04 +0000 (11:12 +0300)
committerOleksiy Hryshchenko <greeschenko@gmail.com>
Mon, 3 Apr 2023 08:12:04 +0000 (11:12 +0300)
autoload/lsp/completion.vim
autoload/lsp/options.vim
doc/lsp.txt

index 725d07e355a39873e78baab09ec09f21ae827d92..98fbe90af0d11aa07262a1700aefcdcea4e2f13b 100644 (file)
@@ -88,19 +88,21 @@ export def CompletionReply(lspserver: dict<any>, 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<any>, cItems: any)
       endif
     endif
 
-    if item->has_key('info')
-        d.menu = item.info
-    endif
-
     d.user_data = item
     completeItems->add(d)
   endfor
index 3d6d10cce1ae9f769c29959066f0d547c97acf52..b3b8dfbff13c4ce7e4cde8443695f10d8bd5b2d9 100644 (file)
@@ -54,6 +54,8 @@ export var lspOptions: dict<any> = {
   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`
index 384f3c9fd42e927a1250af01424547c9a41f5759..0521124335ba93f6058bcd2410211248d14dd55c 100644 (file)
@@ -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.