import './util.vim'
-# A buffer can have one or more attached language servers. The
+# A buffer can have one or more attached language servers. The
# "bufnrToServers" Dict contains the list of language servers attached to a
-# buffer. The buffer number is the key for the "bufnrToServers" Dict. The
+# buffer. The buffer number is the key for the "bufnrToServers" Dict. The
# value is the List of attached language servers.
var bufnrToServers: dict<list<dict<any>>> = {}
# LSP server is configured to be a provider for "feature"
for lspserver in possibleLSPs
- var has_feature = lspserver.features->get(feature, false)
+ var has_feature: bool = lspserver.features->get(feature, false)
if has_feature
return lspserver
endif
# Return the first LSP server that supports "feature" and doesn't have it
# disabled
for lspserver in possibleLSPs
- if !lspserver.features->has_key(feature)
+ if lspserver.featureEnabled(feature)
return lspserver
endif
endfor
# Param: PublishDiagnosticsParams
export def DiagNotification(lspserver: dict<any>, uri: string, diags_arg: list<dict<any>>): void
# Diagnostics are disabled for this server?
- var diagSupported = lspserver.features->get('diagnostics', true)
- if !diagSupported
+ if !lspserver.featureEnabled('diagnostics')
return
endif
endif
enddef
-# Return the sorted diagnostics for buffer "bnr". Default is the current
-# buffer. A copy of the diagnostics is returned so that the caller can modify
+# Return the sorted diagnostics for buffer "bnr". Default is the current
+# buffer. A copy of the diagnostics is returned so that the caller can modify
# the diagnostics.
export def GetDiagsForBuf(bnr: number = bufnr()): list<dict<any>>
if !diagsMap->has_key(bnr) ||
endwhile
enddef
+# Returns true when the "lspserver" has "feature" enabled.
+# By default, all the features of a lsp server are enabled.
+def FeatureEnabled(lspserver: dict<any>, feature: string): bool
+ return lspserver.features->get(feature, true)
+enddef
+
# Retrieve the Workspace configuration asked by the server.
# Request: workspace/configuration
def WorkspaceConfigGet(lspserver: dict<any>, configItem: dict<any>): dict<any>
decodeLocation: function(offset.DecodeLocation, [lspserver]),
getPosition: function(GetPosition, [lspserver]),
getTextDocPosition: function(GetTextDocPosition, [lspserver]),
+ featureEnabled: function(FeatureEnabled, [lspserver]),
textdocDidOpen: function(TextdocDidOpen, [lspserver]),
textdocDidClose: function(TextdocDidClose, [lspserver]),
textdocDidChange: function(TextdocDidChange, [lspserver]),
# If true, diagnostics will be sent to ale, which will be responsible for
# showing them.
aleSupport: false,
+
# In insert mode, complete the current symbol automatically
# Otherwise, use omni-completion
autoComplete: true,
+
# In normal mode, highlight the current symbol automatically
autoHighlight: false,
+
# Automatically highlight diagnostics messages from LSP server
autoHighlightDiags: true,
+
# Automatically populate the location list with new diagnostics
autoPopulateDiags: false,
+
# icase | fuzzy | case match for language servers that replies with a full
# list of completion items
completionMatcher: 'case',
+
# Due to a bug in the earlier versions of Vim, cannot use the
# COMPLETIONMATCHER_CASE constant here for initialization.
completionMatcherValue: 1,
+
# diagnostics signs options
diagSignErrorText: 'E>',
diagSignHintText: 'H>',
diagSignInfoText: 'I>',
diagSignWarningText: 'W>',
+
# In insert mode, echo the current symbol signature in the status line
# instead of showing it in a popup
echoSignature: false,
+
# hide disabled code actions
hideDisabledCodeActions: false,
+
# Highlight diagnostics inline
highlightDiagInline: true,
+
# Show the symbol documentation in the preview window instead of in a popup
hoverInPreview: false,
+
# Don't print message when a configured language server is missing.
ignoreMissingServer: false,
+
# Focus on the location list window after ":LspDiag show"
keepFocusInDiags: true,
+
# Focus on the location list window after LspShowReferences
keepFocusInReferences: true,
+
# If true, apply the LSP server supplied text edits after a completion.
# If a snippet plugin is going to apply the text edits, then set this to
# false to avoid applying the text edits twice.
completionTextEdit: true,
+
# Alignment of virtual diagnostic text, when showDiagWithVirtualText is true
# Allowed values: 'above' | 'below' | 'after' (default is 'above')
diagVirtualTextAlign: 'above',
+
# Suppress adding a new line on completion selection with <CR>
noNewlineInCompletion: false,
+
# Open outline window on right side
outlineOnRight: false,
+
# Outline window size
outlineWinSize: 20,
+
# Show diagnostic text in a balloon when the mouse is over the diagnostic
showDiagInBalloon: true,
+
# Make diagnostics show in a popup instead of echoing
showDiagInPopup: true,
+
# Suppress diagnostic hover from appearing when the mouse is over the line
# Show a diagnostic message on a status line
showDiagOnStatusLine: false,
+
# Show a diagnostic messages using signs
showDiagWithSign: true,
+
# Show a diagnostic messages with virtual text
showDiagWithVirtualText: false,
+
# enable inlay hints
showInlayHints: false,
+
# In insert mode, show the current symbol signature automatically
showSignature: true,
+
# enable snippet completion support
snippetSupport: false,
+
# enable SirVer/ultisnips completion support
ultisnipsSupport: false,
+
# add to autocomplition list current buffer words
useBufferCompletion: 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`
useQuickfixForLocations: false,
+
# enable hrsh7th/vim-vsnip completion support
vsnipSupport: false,
+
# Limit the time autocompletion searches for words in current buffer (in
# milliseconds)
bufferCompletionTimeout: 100,
+
# Enable support for custom completion kinds
customCompletionKinds: false,
+
# A dictionary with all completion kinds that you want to customize
completionKinds: {}
}
# close the signature popup window
def CloseSignaturePopup(lspserver: dict<any>)
- lspserver.signaturePopup->popup_close()
+ if lspserver.signaturePopup != -1
+ lspserver.signaturePopup->popup_close()
+ endif
lspserver.signaturePopup = -1
enddef
def CloseCurBufSignaturePopup()
- var lspserver: dict<any> = buf.CurbufGetServer()
+ var lspserver: dict<any> = buf.CurbufGetServer('signatureHelp')
if lspserver->empty()
return
endif
endif
if !opt.lspOptions.showSignature
+ || !lspserver.featureEnabled('signatureHelp')
# Show signature support is disabled
return
endif
# page, then use it.
var winID = fname->bufwinid()
if winID == -1
- # not present in the current tab page. Use the first window.
+ # not present in the current tab page. Use the first window.
winID = winList[0]
endif
winID->win_gotoid()
Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
For Vim version 9.0 and above
-Last change: June 25, 2023
+Last change: July 26, 2023
==============================================================================
CONTENTS *lsp-contents*
*lsp-cfg-traceLevel*
traceLevel (Optional) set the debug trace level for this language
- server. Supported values are: "off", "debug" and
+ server. Supported values are: "off", "debug" and
"verbose". By default this is seto "off".
The language servers are added using the LspAddServer() function. This
Remove a folder from the workspace
==============================================================================
-6. Insert mode completion *lsp-ins-mode-completion*
+6. Insert Mode Completion *lsp-ins-mode-completion*
By default, in insert mode, the LSP plugin automatically displays the matches
for the symbol under the cursor in an insert-completion popup menu. You can
The ":LspDiag show" command creates a new location list with the current list
of diagnostics for the current buffer. To automatically add the diagnostics
messages to the location list, you can set the 'autoPopulateDiags' option to
-true. By default this option is set to false. When new diagnostics are
+true. By default this option is set to false. When new diagnostics are
received for a buffer, if a location list with the diagnostics is already
present, then it is refreshed with the new diagnostics.
default this is set to true.
The lsp#diag#GetDiagsForBuf() function can be used to get all the LSP
-diagnostics in a buffer. This function optionally accepts a buffer number.
+diagnostics in a buffer. This function optionally accepts a buffer number.
If the buffer number argument is not specified, then the current buffer is
-used. This function returns a |List| of diagnostics sorted by their line and
-column number. Each diagnostic is a |Dict| returned by the language server.
+used. This function returns a |List| of diagnostics sorted by their line and
+column number. Each diagnostic is a |Dict| returned by the language server.
==============================================================================
8. Tag Function *lsp-tagfunc*
LspDiagsUpdated A |User| autocommand invoked when new
diagnostics are received from the language
server. This is invoked after the LSP client
- has processed the diagnostics. The function
+ has processed the diagnostics. The function
lsp#diag#GetDiagsForBuf() can be used to get
all the diagnostics for a buffer.