and related interfaces). >lua
local client = assert(vim.lsp.get_clients()[1])
client:request('textDocument/definition')
- Setting a field in `vim.lsp.handlers`. This global table contains the
default mappings of |lsp-method| names to handlers. (Note: only for
server-to-client requests/notifications, not client-to-server.)
Example: >lua
vim.lsp.handlers['textDocument/publishDiagnostics'] = my_custom_diagnostics_handler
- Passing a {handlers} parameter to |vim.lsp.start()|. This sets the default
|lsp-handler| for a specific server. (Note: only for server-to-client
requests/notifications, not client-to-server.)
Example: >lua
vim.lsp.start {
..., -- Other configuration omitted.
handlers = {
['textDocument/publishDiagnostics'] = my_custom_diagnostics_handler
},
}
- Passing a {handler} parameter to |vim.lsp.buf_request_all()|. This sets the
|lsp-handler| ONLY for the given request(s).
Example: >lua
vim.lsp.buf_request_all(
0,
'textDocument/publishDiagnostics',
my_request_params,
my_handler
)
<
*vim.lsp.log_levels*
Log levels are defined in |vim.log.levels|
VIM.LSP.PROTOCOL *vim.lsp.protocol*
Module `vim.lsp.protocol` defines constants dictated by the LSP specification,
and helper functions for creating protocol-related objects.
https://github.com/microsoft/language-server-protocol/raw/gh-pages/_specifications/specification-3-14.md
For example `vim.lsp.protocol.ErrorCodes` allows reverse lookup by number or
name: >lua
vim.lsp.protocol.TextDocumentSyncKind.Full == 1
vim.lsp.protocol.TextDocumentSyncKind[1] == "Full"
<
*lsp-response*
LSP response shape:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#responseMessage
*lsp-notification*
LSP notification shape:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage
================================================================================
LSP HIGHLIGHT *lsp-highlight*
Reference Highlights:
Highlight groups that are meant to be used by |vim.lsp.buf.document_highlight()|.
You can see more about the differences in types here:
https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight
*hl-LspReferenceText*
LspReferenceText used for highlighting "text" references
*hl-LspReferenceRead*
LspReferenceRead used for highlighting "read" references
*hl-LspReferenceWrite*
LspReferenceWrite used for highlighting "write" references
*hl-LspReferenceTarget*
LspReferenceTarget used for highlighting reference targets (e.g. in a
hover range)
*hl-LspInlayHint*
LspInlayHint used for highlighting inlay hints
*lsp-highlight-codelens*
Highlight groups related to |lsp-codelens| functionality.
*hl-LspCodeLens*
LspCodeLens
Used to color the virtual text of the codelens. See
|nvim_buf_set_extmark()|.
LspCodeLensSeparator *hl-LspCodeLensSeparator*
Used to color the separator between two or more code lenses.
*lsp-highlight-signature*
Highlight groups related to |vim.lsp.handlers.signature_help()|.