Command|Description
-------|-----------
:LspCodeAction|Apply the code action supplied by the language server to the diagnostic in the current line.
-:LspDiagCurrent|Display the diagnostic message for the current line
-:LspDiagFirst|Jump to the first diagnostic message for the current buffer
-:LspDiagHere|Jump to the next diagnostic message in the current line
-:LspDiagHighlightDisable|Disable diagnostic message highlights
-:LspDiagHighlightEnable|Enable diagnostic message highlights
-:LspDiagNext|Jump to the next diagnostic message after the current position
-:LspDiagPrev|Jump to the previous diagnostic message before the current position
+:LspDiagCurrent|Display the diagnostic message for the current line.
+:LspDiagFirst|Jump to the first diagnostic message for the current buffer.
+:LspDiagHere|Jump to the next diagnostic message in the current line.
+:LspDiagHighlightDisable|Disable diagnostic message highlights.
+:LspDiagHighlightEnable|Enable diagnostic message highlights.
+:LspDiagNext|Jump to the next diagnostic message after the current position.
+:LspDiagPrev|Jump to the previous diagnostic message before the current position.
:LspDiagShow|Display the diagnostics messages from the language server for the current buffer in a new location list.
-:LspFold|Fold the current file
+:LspFold|Fold the current file.
:LspFormat|Format a range of lines in the current file using the language server. The **shiftwidth** and **expandtab** values set for the current buffer are used when format is applied. The default range is the entire file.
-:LspGotoDeclaration|Go to the declaration of the keyword under cursor
-:LspGotoDefinition|Go to the definition of the keyword under cursor
-:LspGotoImpl|Go to the implementation of the keyword under cursor
-:LspGotoTypeDef|Go to the type definition of the keyword under cursor
-:LspHighlight|Highlight all the matches for the keyword under cursor
-:LspHighlightClear|Clear all the matches highlighted by :LspHighlight
+:LspGotoDeclaration|Go to the declaration of the keyword under cursor.
+:LspGotoDefinition|Go to the definition of the keyword under cursor.
+:LspGotoImpl|Go to the implementation of the keyword under cursor.
+:LspGotoTypeDef|Go to the type definition of the keyword under cursor.
+:LspHighlight|Highlight all the matches for the keyword under cursor.
+:LspHighlightClear|Clear all the matches highlighted by :LspHighlight.
:LspHover|Show the documentation for the symbol under the cursor in a popup window.
:LspIncomingCalls|Display the list of symbols calling the current symbol.
:LspOutgoingCalls|Display the list of symbols called by the current symbol.
:LspPeekImpl|Open the implementation of the symbol under cursor in the preview window.
:LspPeekReferences|Display the list of references to the keyword under cursor in a location list associated with the preview window.
:LspPeekTypeDef|Open the type definition of the symbol under cursor in the preview window.
-:LspRename|Rename the current symbol
-:LspSelectionExpand|Expand the current symbol range visual selection
-:LspSelectionShrink|Shrink the current symbol range visual selection
-:LspServerRestart|Restart the language server for the current buffer
+:LspRename|Rename the current symbol.
+:LspSelectionExpand|Expand the current symbol range visual selection.
+:LspSelectionShrink|Shrink the current symbol range visual selection.
+:LspShowAllServers|Display information about all the registered language servers.
+:LspServerRestart|Restart the language server for the current buffer.
:LspShowReferences|Display the list of references to the keyword under cursor in a new location list.
-:LspShowServers|Display the list of registered language servers
-:LspShowServerCapabilities|Display the language server capabilities for the current buffer
-:LspShowSignature|Display the signature of the keyword under cursor
-:LspSubTypeHierarchy|Display the sub type hierarchy in a popup window
-:LspSuperTypeHierarchy|Display the super type hierarchy in a popup window
+:LspShowServer|Display the language server status for the current buffer.
+:LspShowServerCapabilities|Display the language server capabilities for the current buffer.
+:LspShowSignature|Display the signature of the keyword under cursor.
+:LspSubTypeHierarchy|Display the sub type hierarchy in a popup window.
+:LspSuperTypeHierarchy|Display the super type hierarchy in a popup window.
:LspSwitchSourceHeader|Switch between a source and a header file.
-:LspSymbolSearch|Perform a workspace wide search for a symbol
-:LspWorkspaceAddFolder `{folder}`| Add a folder to the workspace
-:LspWorkspaceListFolders|Show the list of folders in the workspace
-:LspWorkspaceRemoveFolder `{folder}`|Remove a folder from the workspace
+:LspSymbolSearch|Perform a workspace wide search for a symbol.
+:LspWorkspaceAddFolder `{folder}`| Add a folder to the workspace.
+:LspWorkspaceListFolders|Show the list of folders in the workspace.
+:LspWorkspaceRemoveFolder `{folder}`|Remove a folder from the workspace.
## Similar Vim LSP Plugins
enddef
# Show information about all the LSP servers
-export def ShowServers()
+export def ShowAllServers()
+ var lines = []
+ # Add filetype to server mapping information
+ lines->add('Filetype Information')
+ lines->add('====================')
for [ftype, lspserver] in ftypeServerMap->items()
- var msg = $'{ftype} '
- if lspserver.running
- msg ..= 'running'
- else
- msg ..= 'not running'
+ lines->add($"Filetype: '{ftype}'")
+ lines->add($"Server Path: '{lspserver.path}'")
+ lines->add($"Status: {lspserver.running ? 'Running' : 'Not running'}")
+ lines->add('')
+ endfor
+
+ # Add buffer to server mapping information
+ lines->add('Buffer Information')
+ lines->add('==================')
+ for bnr in range(1, bufnr('$'))
+ if buf.BufHasLspServer(bnr)
+ lines->add($"Buffer: '{bufname(bnr)}'")
+ var lspserver = buf.BufLspServerGet(bnr)
+ lines->add($"Server Path: '{lspserver.path}'")
+ lines->add($"Status: {lspserver.running ? 'Running' : 'Not running'}")
+ lines->add('')
endif
- msg ..= $' {lspserver.path}'
- :echomsg msg
endfor
+
+ var wid = bufwinid('Language-Servers')
+ if wid != -1
+ wid->win_gotoid()
+ :setlocal modifiable
+ :silent! :%d _
+ else
+ :new Language-Servers
+ :setlocal buftype=nofile
+ :setlocal bufhidden=wipe
+ :setlocal noswapfile
+ :setlocal nonumber nornu
+ :setlocal fdc=0 signcolumn=no
+ endif
+ setline(1, lines)
+ :setlocal nomodified
+ :setlocal nomodifiable
+enddef
+
+# Show the status of the LSP server for the current buffer
+export def ShowServer()
+ var lspserver: dict<any> = buf.CurbufGetServerChecked()
+ if lspserver->empty()
+ :echomsg "LSP Server not found"
+ return
+ endif
+
+ var msg = $"LSP server '{lspserver.path}' is "
+ if lspserver.running
+ msg ..= 'running'
+ else
+ msg ..= 'not running'
+ endif
+ :echomsg msg
enddef
# Get LSP server running status for filetype 'ftype'
# Make diagnostics show in a popup instead of echoing
showDiagInPopup: true,
# Default diagnostic highlight on lines
- diagLineHL: 'Cursor',
+ diagLineHL: 'DiffAdd',
# Don't print message when a configured language server is missing.
ignoreMissingServer: false,
# Use a floating menu to show the code action menu instead of asking for input
:LspServerDebug Enable or disable the language server debug messages.
:LspServerRestart Restart the language server for the current buffer.
:LspServerTrace Set the language server debug trace value.
+:LspShowAllServers Display the status of all the registered language
+ servers.
:LspShowReferences Display the list of references to the keyword under
cursor in a new location list.
:LspShowServerCapabilities
Display the language server capabilities for the
current buffer.
-:LspShowServers Display the list of registered language servers
+:LspShowServer Display the status of the language server for the
+ current buffer.
:LspShowSignature Display the signature of the symbol under cursor.
:LspSubTypeHierarchy Display the sub type hierarchy in a popup window.
:LspSuperTypeHierarchy Display the super type hierarchy in a popup window.
autoPopulateDiags |Boolean| option. Automatically populate the location
list with diagnostics from the language server.
By default this is set to false.
-diagLineHL |String| option. Highlight used for diagnostic line.
- By default uses "Cursor". Use "NONE" to disable.
+diagLineHL |String| option. The highlight group used for a line
+ with one or more diagnostics. By default uses
+ "DiffAdd". Use "NONE" to disable.
echoSignature |Boolean| option. In insert mode, echo the current
symbol signature instead of showing it in a popup.
By default this is set to false.
:LspServerTrace { off | messages | verbose } *:LspServerTrace*
Set the language server debug trace value.
+ *:LspShowAllServers*
+:LspShowAllServers Displays the list of registered language servers and
+ their status. The language servers are registered
+ using the LspAddServer() function. The output is
+ displayed in a scratch buffer. The output shows the
+ Vim file type, the corresponding language server
+ status and the path to the language server executable.
+ The language server information for each buffer is
+ also shown.
+
*:LspShowReferences*
:LspShowReferences Creates a new location list with the list of locations
where the symbol under the cursor is referenced and
described in the LSP protocol specification under the
"ServerCapabilities" interface.
- *:LspShowServers*
-:LspShowServers Displays the list of registered language servers and
- their status. The language servers are registered
- using the LspAddServer() function. The output shows
- the Vim file type, the corresponding language server
- status and the path to the language server executable.
+ *:LspShowServer*
+:LspShowServer Displays the language server status for the current
+ buffer. The output shows the path to the language
+ server executable and the server status.
*:LspShowSignature*
:LspShowSignature Displays the signature of the symbol (e.g. a function
command! -nargs=1 -complete=customlist,LspServerTraceComplete -bar LspServerTrace lsp.ServerTraceSet(<q-args>)
command! -nargs=0 -bar LspShowReferences lsp.ShowReferences(v:false)
command! -nargs=0 -bar LspShowServerCapabilities lsp.ShowServerCapabilities()
-command! -nargs=0 -bar LspShowServers lsp.ShowServers()
+command! -nargs=0 -bar LspShowServer lsp.ShowServer()
+command! -nargs=0 -bar LspShowAllServers lsp.ShowAllServers()
command! -nargs=0 -bar LspShowSignature call LspShowSignature()
# Clangd specifc extension to switch from one C/C++ source file to a
# corresponding header file