completionItem: {
documentationFormat: ['plaintext', 'markdown'],
resolveSupport: {properties: ['detail', 'documentation']},
- snippetSupport: false
+ snippetSupport: opt.lspOptions.snippetSupport
},
completionItemKind: {valueSet: range(1, 25)}
},
return kindMap[kind]
enddef
+# Remove all the snippet placeholders from 'str' and return the value.
+# Based on a similar function in the vim-lsp plugin.
+def MakeValidWord(str_arg: string): string
+ var str = substitute(str_arg, '\$[0-9]\+\|\${\%(\\.\|[^}]\)\+}', '', 'g')
+ str = substitute(str, '\\\(.\)', '\1', 'g')
+ var valid = matchstr(str, '^[^"'' (<{\[\t\r\n]\+')
+ if empty(valid)
+ return str
+ endif
+ if valid =~# ':$'
+ return valid[: -2]
+ endif
+ return valid
+enddef
+
# process the 'textDocument/completion' reply from the LSP server
# Result: CompletionItem[] | CompletionList | null
def CompletionReply(lspserver: dict<any>, cItems: any)
else
d.word = item.label
endif
+ if item->get('insertTextFormat', 1) == 2
+ # snippet completion. Needs a snippet plugin to expand the snippet.
+ # Remove all the snippet placeholders
+ d.word = MakeValidWord(d.word)
+ endif
d.abbr = item.label
d.dup = 1
if item->has_key('kind')
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 9.0 and above
-Last change: Oct 26, 2022
+Last change: Oct 30, 2022
==============================================================================
*lsp-license*
autoHighlight In normal mode, automatically highlight all the
occurrences of the symbol under the cursor. By default
this is set to false.
-showSignature In insert mode, automatically show the current symbol
- signature in a popup. By default this is set to true.
-echoSignature In insert mode, echo the current symbol signature
- instead of showing it in a popup. By default this is
- set to false.
autoHighlightDiags Automatically place signs on the lines with a
diagnostic message from the LSP server. By default
this is set to true.
autoPopulateDiags Automatically populate the location list with
diagnostics from the LSP server. By default this is
set to false.
+echoSignature In insert mode, echo the current symbol signature
+ instead of showing it in a popup. By default this is
+ set to false.
+ignoreMissingServer Do not print a missing language server executable.
+ By default this is set to false.
keepFocusInReferences Focus on the location list window after
LspShowReferences. By default this is set to false.
+noDiagHoverOnLine Suppress diagnostic hover from appearing when
+ the mouse is over the line instead of the signature.
+ By default this is set to true.
noNewlineInCompletion Suppress adding a new line on completion selection
with <CR>.
By default this is set to false.
-outlineWinSize Outline window size, by default this is 20.
outlineOnRight Open the outline window on the right side, by default
this is false.
-noDiagHoverOnLine Suppress diagnostic hover from appearing when
- the mouse is over the line instead of the signature.
- By default this is set to true.
-showDiagOnStatusLine Show a diagnostic message on a status line.
- By default this is set to false.
+outlineWinSize Outline window size, by default this is 20.
showDiagInPopup When using the |:LspDiagCurrent| command to display
the diagnostic message for the current line, use a
popup window to display the message instead of
echoing in the status area. By default this is set to
true.
+showDiagOnStatusLine Show a diagnostic message on a status line.
+ By default this is set to false.
+showSignature In insert mode, automatically show the current symbol
+ signature in a popup. By default this is set to true.
+snippetSupport Enable snippet completion support. Need a snippet
+ completion plugin like vim-vsnip. By default this is
+ set to false.
usePopupInCodeAction When using the |:LspCodeAction| command to display the
code action for the current line, use a popup menu
instead of echoing.
By default this is set to false.
-ignoreMissingServer Do not print a missing language server executable.
- By default this is set to false.
For example, to disable the automatic placement of signs for the LSP
diagnostic messages, you can add the following line to your .vimrc file: