Requires N:M mapping

This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

This mapping has 9 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

Before

…lines 1–611 unchanged (611 lines)
612end
613
614--- @private
615function Client:_process_static_registrations()
616 local static_registrations = {} ---@type lsp.Registration[]
617
618 for method, capability in pairs(lsp.protocol._request_name_to_server_capability) do
619 if
620 vim.tbl_get(self.server_capabilities, unpack(capability), 'id')
621 --- @cast method vim.lsp.protocol.Method
622 and self:_supports_registration(method)
623 then
624 local cap = vim.tbl_get(self.server_capabilities, unpack(capability))
625 static_registrations[#static_registrations + 1] = {
626 id = cap.id,
627 method = method,
628 registerOptions = {
629 documentSelector = cap.documentSelector, ---@type lsp.DocumentSelector|lsp.null
630 },
631 }
632 end
633 end
634
635 if next(static_registrations) then
636 self:_register_dynamic(static_registrations)
…lines 637–932 unchanged (296 lines)
933 self:stop(force)
934end
935
936--- Get options for a method that is registered dynamically.
937--- @param method vim.lsp.protocol.Method | vim.lsp.protocol.Method.Registration
938function Client:_supports_registration(method)
939 local capability_path = lsp.protocol._request_name_to_client_capability[method] or {}
940 -- dynamicRegistration is at the second level, even in deeply nested capabilities
941 local capability = vim.tbl_get(self.capabilities, capability_path[1], capability_path[2])
942 return type(capability) == 'table' and capability.dynamicRegistration
943end
944
945--- Get provider for a method to be registered dynamically.
946--- @param method vim.lsp.protocol.Method | vim.lsp.protocol.Method.Registration
947function Client:_registration_provider(method)
948 local capability_path = lsp.protocol._request_name_to_server_capability[method]
949 return capability_path and capability_path[1] or method
950end
951
952--- @private
953--- @param registrations lsp.Registration[]
954function Client:_register_dynamic(registrations)
955 -- remove duplicates
…lines 956–1201 unchanged (246 lines)
1202 if required_capability and vim.tbl_get(self.server_capabilities, unpack(required_capability)) then
1203 return true
1204 end
1205
1206 local provider = self:_registration_provider(method)
1207 local regs = self:_get_registrations(provider, bufnr)
1208 if lsp.protocol._request_name_allows_registration[method] and not regs then
1209 return false
1210 end
1211 if regs then
1212 for _, reg in ipairs(regs or {}) do
1213 if required_capability and #required_capability > 1 then
1214 if vim.tbl_get(reg, 'registerOptions', unpack(required_capability, 2)) then
1215 return self:_supports_registration(reg.method)
1216 end
1217 else
1218 return self:_supports_registration(reg.method)
1219 end
1220 end
1221 return false
1222 end
1223
1224 -- if we don't know about the method, assume that the client supports it.
1225 -- This needs to be at the end, so that dynamic_capabilities are checked first
1226 return required_capability == nil
1227end
1228
1229--- @private
1230--- Handles a notification sent by an LSP server by invoking the
1231--- corresponding handler.
1232---
1233--- @param method vim.lsp.protocol.Method.ServerToClient.Notification LSP method name
1234--- @param params table The parameters for that method.
…lines 1235–1442 unchanged (208 lines)

After

…lines 1–611 unchanged (611 lines)
612end
613
614--- @private
615function Client:_process_static_registrations()
616 local static_registrations = {} ---@type lsp.Registration[]
617
618 for method in pairs(lsp.protocol._method_supports_static_registration) do
619 local capability = lsp.protocol._request_name_to_server_capability[method]
620 if
621 vim.tbl_get(self.server_capabilities, capability[1], 'id')
622 and self:_supports_registration(method)
623 then
624 local cap = vim.tbl_get(self.server_capabilities, capability[1])
625 static_registrations[#static_registrations + 1] = {
626 id = cap.id,
627 method = method,
628 registerOptions = cap or {},
629 }
630 end
631 end
632
633 if next(static_registrations) then
634 self:_register_dynamic(static_registrations)
…lines 635–930 unchanged (296 lines)
931 self:stop(force)
932end
933
934--- Get options for a method that is registered dynamically.
935--- @param method vim.lsp.protocol.Method | vim.lsp.protocol.Method.Registration
936function Client:_supports_registration(method)
937 if lsp.protocol._methods_with_no_registration_options[method] then
938 return true
939 end
940 local provider = self:_registration_provider(method)
941 local capability_path = lsp.protocol._provider_to_client_registration[provider]
942 local capability = vim.tbl_get(self.capabilities, unpack(capability_path))
943 return type(capability) == 'table' and capability.dynamicRegistration
944end
945
946--- Get provider for a method to be registered dynamically.
947--- @param method vim.lsp.protocol.Method | vim.lsp.protocol.Method.Registration
948function Client:_registration_provider(method)
949 local capability_path = lsp.protocol._request_name_to_server_capability[method]
950 return capability_path and capability_path[1]
951end
952
953--- @private
954--- @param registrations lsp.Registration[]
955function Client:_register_dynamic(registrations)
956 -- remove duplicates
957 self:_unregister_dynamic(registrations)
…lines 958–1202 unchanged (245 lines)
1203 if required_capability and vim.tbl_get(self.server_capabilities, unpack(required_capability)) then
1204 return true
1205 end
1206
1207 local provider = self:_registration_provider(method)
1208 local regs = self:_get_registrations(provider, bufnr)
1209 if lsp.protocol._method_supports_dynamic_registration[method] and not regs then
1210 return false
1211 end
1212 if regs then
1213 for _, reg in ipairs(regs or {}) do
1214 if required_capability and #required_capability > 1 then
1215 if vim.tbl_get(reg, 'registerOptions', unpack(required_capability, 2)) then
1216 return self:_supports_registration(reg.method)
1217 end
1218 if lsp.protocol._methods_with_no_registration_options[method] then
1219 return true
1220 end
1221 else
1222 return self:_supports_registration(reg.method)
1223 end
1224 end
1225 return false
1226 end
1227
1228 -- if we don't know about the method, assume that the client supports it.
1229 -- This needs to be at the end, so that dynamic_capabilities are checked first
1230 return required_capability == nil
1231end
1232
1233--- Retrieves all capability values for a given LSP method, handling both static and dynamic registrations.
1234--- This function abstracts over differences between capabilities declared in `server_capabilities`
1235--- and those registered dynamically at runtime, returning all matching capability values.
1236--- It also handles cases where the registration method differs from the calling method by abstracting to the Provider.
1237--- For example, `workspace/diagnostic` uses capabilities registered under `textDocument/diagnostic`.
1238--- This is useful for features like diagnostics and formatting, where servers may register multiple providers
1239--- with different options (such as specific filetypes or document selectors).
1240--- @param method vim.lsp.protocol.Method.ClientToServer | vim.lsp.protocol.Method.Registration LSP method name
1241--- @param ... any Additional keys to index into the capability
1242--- @return lsp.LSPAny[] # The capability value if it exists, empty table if not found
1243function Client:_provider_value_get(method, ...)
1244 local matched_regs = {} --- @type any[]
1245 local provider = self:_registration_provider(method)
1246 local dynamic_regs = self:_get_registrations(provider)
1247 if not provider then
1248 return matched_regs
1249 elseif not dynamic_regs then
1250 -- First check static capabilities
1251 local static_reg = vim.tbl_get(self.server_capabilities, provider)
1252 if static_reg then
1253 matched_regs[1] = vim.tbl_get(static_reg, ...) or vim.NIL
1254 end
1255 else
1256 local required_capability = lsp.protocol._request_name_to_server_capability[method]
1257 for _, reg in ipairs(dynamic_regs) do
1258 if vim.tbl_get(reg, 'registerOptions', unpack(required_capability, 2)) then
1259 matched_regs[#matched_regs + 1] = vim.tbl_get(reg, 'registerOptions', ...) or vim.NIL
1260 end
1261 end
1262 end
1263
1264 return matched_regs
1265end
1266
1267--- @private
1268--- Handles a notification sent by an LSP server by invoking the
1269--- corresponding handler.
1270---
1271--- @param method vim.lsp.protocol.Method.ServerToClient.Notification LSP method name
…lines 1272–1480 unchanged (209 lines)

Before

chunk
variable_declaration
local "local"
assignment_statement
variable_list
identifier "uv"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "uv"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "api"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "api"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "lsp"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "lsp"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "log"
= "="
expression_list
dot_index_expression
identifier "lsp"
. "."
identifier "log"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "changetracking"
= "="
expression_list
dot_index_expression
identifier "lsp"
. "."
identifier "_changetracking"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "validate"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "validate"
comment
-- "--"
comment_content "- Tracks all clients initialized."
comment
-- "--"
comment_content "-@type table<integer,vim.lsp.Client>"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "all_clients"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_init_cb fun(client: vim.lsp.Clien"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_attach_cb fun(client: vim.lsp.Cli"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_exit_cb fun(code: integer, signal"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.before_init_cb fun(params: lsp.Initi"...
comment
-- "--"
comment_content "- @class vim.lsp.Client.Flags"
comment
-- "--"
comment_content "- @inlinedoc"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Allow using incremental sync for buffer edits"
comment
-- "--"
comment_content "- (default: `true`)"
comment
-- "--"
comment_content "- @field allow_incremental_sync? boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Debounce `didChange` notifications to the server by the gi"...
comment
-- "--"
comment_content "- (default: `150`)"
comment
-- "--"
comment_content "- @field debounce_text_changes? integer"
comment
-- "--"
comment_content "- @class vim.lsp.ClientConfig"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback which can modify parameters before they are sent "...
comment
-- "--"
comment_content "- \"initialize\" phase (after `cmd` is invoked), where `params"...
comment
-- "--"
comment_content "- server and `config` is the config passed to |vim.lsp.start"...
comment
-- "--"
comment_content "- @field before_init? fun(params: lsp.InitializeParams, conf"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map overriding the default capabilities defined by |vim.ls"...
comment
-- "--"
comment_content "- passed to the language server on initialization. Hint: use"...
comment
-- "--"
comment_content "- its result."
comment
-- "--"
comment_content "- - Note: To send an empty dictionary use |vim.empty_dict()|"...
comment
-- "--"
comment_content "- array."
comment
-- "--"
comment_content "- @field capabilities? lsp.ClientCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Command `string[]` that launches the language server (trea"...
comment
-- "--"
comment_content "- absolute or on `$PATH`, shell constructs like \"~\" are not "...
comment
-- "--"
comment_content "- RPC client. Function receives a `dispatchers` table and th"...
comment
-- "--"
comment_content "- a table with member functions `request`, `notify`, `is_clo"...
comment
-- "--"
comment_content "- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|."
comment
-- "--"
comment_content "- For TCP there is a builtin RPC client factory: |vim.lsp.rp"...
comment
-- "--"
comment_content "- @field cmd string[]|fun(dispatchers: vim.lsp.rpc.Dispatche"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Directory to launch the `cmd` process. Not related to `roo"...
comment
-- "--"
comment_content "- (default: cwd)"
comment
-- "--"
comment_content "- @field cmd_cwd? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Environment variables passed to the LSP process on spawn. "...
comment
-- "--"
comment_content "- string."
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- ```lua"
comment
-- "--"
comment_content "- { PORT = 8080; HOST = '0.0.0.0'; }"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- @field cmd_env? table"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of client-defined commands overriding the global |vim."...
comment
-- "--"
comment_content "- @field commands? table<string,fun(command: lsp.Command, ct"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Daemonize the server process so that it runs in a separate"...
comment
-- "--"
comment_content "- Nvim will shutdown the process on exit, but if Nvim fails "...
comment
-- "--"
comment_content "- behind orphaned server processes."
comment
-- "--"
comment_content "- (default: `true`)"
comment
-- "--"
comment_content "- @field detached? boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Milliseconds to wait for server to exit cleanly after send"...
comment
-- "--"
comment_content "- sending kill -15. If set to false, waits indefinitely. If "...
comment
-- "--"
comment_content "- server immediately."
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field exit_timeout? integer|boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Experimental client flags:"
comment
-- "--"
comment_content "- @field flags? vim.lsp.Client.Flags"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Language ID as string. Defaults to the buffer filetype."
comment
-- "--"
comment_content "- @field get_language_id? fun(bufnr: integer, filetype: stri"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of LSP method names to |lsp-handler|s."
comment
-- "--"
comment_content "- @field handlers? table<string,function>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Values to pass in the initialization request as `initializ"...
comment
-- "--"
comment_content "- the LSP spec."
comment
-- "--"
comment_content "- @field init_options? lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Name in logs and user messages."
comment
-- "--"
comment_content "- (default: client-id)"
comment
-- "--"
comment_content "- @field name? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Called \"position encoding\" in LSP spec. The encoding that "...
comment
-- "--"
comment_content "- communication. Not validated. Can be modified in `on_init`"...
comment
-- "--"
comment_content "- @field offset_encoding? 'utf-8'|'utf-16'|'utf-32'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked when client attaches to a buffer."
comment
-- "--"
comment_content "- @field on_attach? elem_or_list<fun(client: vim.lsp.Client,"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked when the client operation throws an error"...
comment
-- "--"
comment_content "- Other arguments may be passed depending on the error kind."...
comment
-- "--"
comment_content "- for possible errors. Use `vim.lsp.rpc.client_errors[code]`"...
comment
-- "--"
comment_content "- @field on_error? fun(code: integer, err: string)"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked on client exit."
comment
-- "--"
comment_content "- - code: exit code of the process"
comment
-- "--"
comment_content "- - signal: number describing the signal used to terminate"...
comment
-- "--"
comment_content "- - client_id: client handle"
comment
-- "--"
comment_content "- @field on_exit? elem_or_list<fun(code: integer, signal: in"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked after LSP \"initialize\", where `result` is"...
comment
-- "--"
comment_content "- anything else the server may send. For example, clangd sen"...
comment
-- "--"
comment_content "- `capabilities.offsetEncoding` was sent to it. You can only"...
comment
-- "--"
comment_content "- here before any notifications are sent."
comment
-- "--"
comment_content "- @field on_init? elem_or_list<fun(client: vim.lsp.Client, i"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Directory where the LSP server will base its workspaceFold"...
comment
-- "--"
comment_content "- @field root_dir? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of language server-specific settings, decided by the c"...
comment
-- "--"
comment_content "- `workspace/configuration`. Keys are case-sensitive."
comment
-- "--"
comment_content "- @field settings? lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Passed directly to the language server in the initialize r"...
comment
-- "--"
comment_content "- (default: \"off\")"
comment
-- "--"
comment_content "- @field trace? 'off'|'messages'|'verbose'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- List of workspace folders passed to the language server. F"...
comment
-- "--"
comment_content "- rootPath are derived from the first workspace folder in th"...
comment
-- "--"
comment_content "- supports workspace folders but none are configured. See `w"...
comment
-- "--"
comment_content "- @field workspace_folders? lsp.WorkspaceFolder[]"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Server requires a workspace (no \"single file\" support). No"...
comment
-- "--"
comment_content "- a workspace, cross-file features (navigation, hover) may o"...
comment
-- "--"
comment_content "- language server, even if the server doesn't require a work"...
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field workspace_required? boolean"
comment
-- "--"
comment_content "- @class vim.lsp.Client.Progress: vim.Ringbuf<{token: intege"...
comment
-- "--"
comment_content "- @field pending table<lsp.ProgressToken,lsp.LSPAny>"
comment
-- "--"
comment_content "- @class vim.lsp.Client"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field attached_buffers table<integer,true>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Capabilities provided by the client (editor or tool), at s"...
comment
-- "--"
comment_content "- @field capabilities lsp.ClientCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Client commands. See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field commands table<string,fun(command: lsp.Command, ctx"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Copy of the config passed to |vim.lsp.start()|."
comment
-- "--"
comment_content "- @field config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Capabilities provided at runtime (after startup)."
comment
-- "--"
comment_content "- @field dynamic_capabilities lsp.DynamicCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Milliseconds to wait for server to exit cleanly after send"...
comment
-- "--"
comment_content "- sending kill -15. If set to false, waits indefinitely. If "...
comment
-- "--"
comment_content "- server immediately."
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field exit_timeout integer|boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Experimental client flags:"
comment
-- "--"
comment_content "- @field flags vim.lsp.Client.Flags"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field get_language_id fun(bufnr: integer, filetype: strin"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field handlers table<string,lsp.Handler>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The id allocated to the client."
comment
-- "--"
comment_content "- @field id integer"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field initialized true?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field name string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field offset_encoding 'utf-8'|'utf-16'|'utf-32'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- A ring buffer (|vim.ringbuf()|) containing progress messag"...
comment
-- "--"
comment_content "- sent by the server."
comment
-- "--"
comment_content "- @field progress vim.lsp.Client.Progress"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The current pending requests in flight to the server. Entr"...
comment
-- "--"
comment_content "- pairs with the key being the request id while the value is"...
comment
-- "--"
comment_content "- `type`, `bufnr`, and `method` key-value pairs. `type` is e"...
comment
-- "--"
comment_content "- for an active request, or \"cancel\" for a cancel request. I"...
comment
-- "--"
comment_content "- \"complete\" ephemerally while executing |LspRequest| autocm"...
comment
-- "--"
comment_content "- are received from the server."
comment
-- "--"
comment_content "- @field requests table<integer,{ type: string, bufnr: integ"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field root_dir string?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- RPC client object, for low level interaction with the clie"...
comment
-- "--"
comment_content "- See |vim.lsp.rpc.start()|."
comment
-- "--"
comment_content "- @field rpc vim.lsp.rpc.PublicClient"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Response from the server sent on `initialize` describing t"...
comment
-- "--"
comment_content "- @field server_capabilities lsp.ServerCapabilities?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Response from the server sent on `initialize` describing s"...
comment
-- "--"
comment_content "- @field server_info lsp.ServerInfo?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field settings lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field workspace_folders lsp.WorkspaceFolder[]?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field _enabled_capabilities table<vim.lsp.capability.Name"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Whether on-type formatting is enabled for this client."
comment
-- "--"
comment_content "- @field _otf_enabled boolean?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Timer for stop() with timeout."
comment
-- "--"
comment_content "- @field private _shutdown_timer uv.uv_timer_t?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Track this so that we can escalate automatically if we've "...
comment
-- "--"
comment_content "- graceful shutdown"
comment
-- "--"
comment_content "- @field private _graceful_shutdown_failed true?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The initial trace setting. If omitted trace is disabled (\""...
comment
-- "--"
comment_content "- trace = \"off\" | \"messages\" | \"verbose\";"
comment
-- "--"
comment_content "- @field private _trace 'off'|'messages'|'verbose'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field private registrations table<string,lsp.Registration"...
comment
-- "--"
comment_content "- @field private _log_prefix string"
comment
-- "--"
comment_content "- @field private _before_init_cb? vim.lsp.client.before_init"...
comment
-- "--"
comment_content "- @field private _on_attach_cbs vim.lsp.client.on_attach_cb["...
comment
-- "--"
comment_content "- @field private _on_init_cbs vim.lsp.client.on_init_cb[]"
comment
-- "--"
comment_content "- @field private _on_exit_cbs vim.lsp.client.on_exit_cb[]"
comment
-- "--"
comment_content "- @field private _on_error_cb? fun(code: integer, err: strin"...
variable_declaration
local "local"
assignment_statement
variable_list
identifier "Client"
= "="
expression_list
table_constructor
{ "{"
} "}"
assignment_statement
variable_list
dot_index_expression
identifier "Client"
. "."
identifier "__index"
= "="
expression_list
identifier "Client"
comment
-- "--"
comment_content "- @param obj table<string,any>"
comment
-- "--"
comment_content "- @param cls table<string,function>"
comment
-- "--"
comment_content "- @param name string"
function_declaration (+134 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "client_index"
= "="
expression_list
number "0"
comment
-- "--"
comment_content "- Checks whether a given path is a directory."
comment
-- "--"
comment_content "- @param filename (string) path to check"
comment
-- "--"
comment_content "- @return boolean # true if {filename} exists and is a direc"...
function_declaration (+61 nodes collapsed)
variable_declaration (+88 nodes collapsed)
comment
-- "--"
comment_content "- Normalizes {encoding} to valid LSP encoding names."
comment
-- "--"
comment_content "- @param encoding string? Encoding to normalize"
comment
-- "--"
comment_content "- @return string # normalized encoding name"
function_declaration (+79 nodes collapsed)
comment
-- "--"
comment_content "- Augments a validator function with support for optional (n"...
comment
-- "--"
comment_content "- @param fn (fun(v): boolean) The original validator functio"...
comment
-- "--"
comment_content "- bool."
comment
-- "--"
comment_content "- @return fun(v): boolean # The augmented function. Also ret"...
comment
-- "--"
comment_content "- `nil`."
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content "- By default, get_language_id just returns the exact filetyp"...
comment
-- "--"
comment_content "- It is possible to pass in something that will calculate a "...
comment
-- "--"
comment_content "- to be sent by the client."
comment
-- "--"
comment_content "- @param _bufnr integer"
comment
-- "--"
comment_content "- @param filetype string"
function_declaration
local "local"
function "function"
identifier "default_get_language_id"
parameters
( "("
identifier "_bufnr"
, ","
identifier "filetype"
) ")"
block
return_statement
return "return"
expression_list
identifier "filetype"
end "end"
comment
-- "--"
comment_content "- Validates a client configuration as given to |vim.lsp.star"...
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
function_declaration (+488 nodes collapsed)
comment
-- "--"
comment_content "- @param trace string"
comment
-- "--"
comment_content "- @return 'off'|'messages'|'verbose'"
function_declaration (+61 nodes collapsed)
comment
-- "--"
comment_content "- @param id integer"
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "- @return string"
function_declaration (+99 nodes collapsed)
comment
-- "--"
comment_content "- @nodoc"
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "- @return vim.lsp.Client?"
function_declaration (+973 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param cbs function[]"
comment
-- "--"
comment_content "- @param error_id integer"
comment
-- "--"
comment_content "- @param ... any"
function_declaration (+73 nodes collapsed)
comment
-- "--"
comment_content "- @nodoc"
function_declaration (+676 nodes collapsed)
comment
-- "--"
comment_content "- @private"
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_process_static_registrations"
parameters
( "("
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "static_registrations"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "-@type lsp.Registration[]"
for_statement
for "for"
for_generic_clause
variable_list
identifier "method"
, ","
identifier "capability"
in "in"
expression_list
function_call
identifier "pairs"
arguments
( "("
dot_index_expression all 1:2
dot_index_expression all 1:2
identifier "lsp" all 1:2
. "." all 1:2
identifier "protocol" all 1:2
. "." all 1:2
identifier "_request_name_to_server_capability"
) ")"
do "do"
block
if_statement
if "if"
binary_expression
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "server_capabilities"
, ","
function_call
identifier "unpack"
arguments
( "("
identifier "capability"
) ")"
, ","
string
' "'"
string_content "id"
' "'"
) ")"
comment
-- "--"
comment_content "- @cast method vim.lsp.protocol.Method"
and "and"
function_call
method_index_expression
identifier "self"
: ":"
identifier "_supports_registration"
arguments
( "("
identifier "method"
) ")"
then "then"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "cap"
= "="
expression_list
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "server_capabilities"
, ","
function_call
identifier "unpack"
arguments
( "("
identifier "capability"
) ")"
) ")"
assignment_statement
variable_list
bracket_index_expression
identifier "static_registrations"
[ "["
binary_expression
unary_expression
# "#"
identifier "static_registrations"
+ "+"
number "1"
] "]"
= "="
expression_list
table_constructor
{ "{"
field
identifier "id"
= "="
dot_index_expression
identifier "cap"
. "."
identifier "id"
, ","
field
identifier "method"
= "="
identifier "method"
, ","
field
identifier "registerOptions"
= "="
table_constructor
{ "{"
field
identifier "documentSelector"
= "="
dot_index_expression
identifier "cap"
. "."
identifier "documentSelector"
, ","
comment
-- "--"
comment_content "-@type lsp.DocumentSelector|lsp.null"
} "}"
, ","
} "}"
end "end"
end "end"
if_statement
if "if"
function_call
identifier "next"
arguments
( "("
identifier "static_registrations"
) ")"
then "then"
block
function_call
method_index_expression
identifier "self"
: ":"
identifier "_register_dynamic"
arguments
( "("
identifier "static_registrations"
) ")"
end "end"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Returns the handler associated with an LSP method."
comment
-- "--"
comment_content "- Returns the default handler if the user hasn't set a custo"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method (vim.lsp.protocol.Method) LSP method name"
comment
-- "--"
comment_content "- @return lsp.Handler? handler for the given method, if defi"...
function_declaration (+33 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param id integer"
comment
-- "--"
comment_content "- @param req_type 'pending'|'complete'|'cancel'"
comment
-- "--"
comment_content "- @param bufnr? integer (only required for req_type='pending"...
comment
-- "--"
comment_content "- @param method? vim.lsp.protocol.Method (only required for "...
function_declaration (+339 nodes collapsed)
comment
-- "--"
comment_content "- Sends a request to the server."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- This is a thin wrapper around {client.rpc.request} with so"...
comment
-- "--"
comment_content "- checks for capabilities and handler availability."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Reque"...
comment
-- "--"
comment_content "- @param params? table LSP request params."
comment
-- "--"
comment_content "- @param handler? lsp.Handler Response |lsp-handler| for thi"...
comment
-- "--"
comment_content "- @param bufnr? integer (default: 0) Buffer handle, or 0 for"...
comment
-- "--"
comment_content "- @return boolean status indicates whether the request was s"...
comment
-- "--"
comment_content "- If it is `false`, then it will always be `false` (the "...
comment
-- "--"
comment_content "- @return integer? request_id Can be used with |Client:cance"...
comment
-- "--"
comment_content "- `nil` is request failed."
comment
-- "--"
comment_content "- to cancel the-request."
comment
-- "--"
comment_content "- @see |vim.lsp.buf_request_all()|"
function_declaration (+326 nodes collapsed)
comment
-- "--"
comment_content " TODO(lewis6991): duplicated from lsp.lua"
variable_declaration (+45 nodes collapsed)
comment
-- "--"
comment_content "- Concatenates and writes a list of strings to the Vim error"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param ... string List to write to the buffer"
function_declaration (+153 nodes collapsed)
comment
-- "--"
comment_content "- Sends a request to the server and synchronously waits for "...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- This is a wrapper around |Client:request()|"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Reque"...
comment
-- "--"
comment_content "- @param params table LSP request params."
comment
-- "--"
comment_content "- @param timeout_ms integer? Maximum time in milliseconds to"...
comment
-- "--"
comment_content "- a result. Defaults to 1000"
comment
-- "--"
comment_content "- @param bufnr? integer (default: 0) Buffer handle, or 0 for"...
comment
-- "--"
comment_content "- @return {err: lsp.ResponseError?, result:any}? `result` an"...
comment
-- "--"
comment_content "- `nil` is the request was unsuccessful"
comment
-- "--"
comment_content "- @return string? err On timeout, cancel or error, where `er"...
comment
-- "--"
comment_content "- string describing the failure reason."
comment
-- "--"
comment_content "- @see |vim.lsp.buf_request_sync()|"
function_declaration (+166 nodes collapsed)
comment
-- "--"
comment_content "- Sends a notification to an LSP server."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Notif"...
comment
-- "--"
comment_content "- @param params table? LSP request params."
comment
-- "--"
comment_content "- @return boolean status indicating if the notification was "...
comment
-- "--"
comment_content "- If it is false, then the client has"...
function_declaration (+127 nodes collapsed)
comment
-- "--"
comment_content "- Cancels a request with a given request id."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param id integer id of request to cancel"
comment
-- "--"
comment_content "- @return boolean status indicating if the notification was "...
comment
-- "--"
comment_content "- @see |Client:notify()|"
function_declaration (+52 nodes collapsed)
comment
-- "--"
comment_content "- Stops a client, optionally with force after a timeout."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- By default, it will request the server to shutdown, then f"...
comment
-- "--"
comment_content "- if the server has not exited after `self.exit_timeout` mil"...
comment
-- "--"
comment_content "- you request to stop a client which has previously been req"...
comment
-- "--"
comment_content "- shutdown, it will automatically escalate and force shutdow"...
comment
-- "--"
comment_content "- regardless of the value of `force` (or `self.exit_timeout`"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Note: Forcing shutdown while a server is busy writing out "...
comment
-- "--"
comment_content "- files can lead to file corruption."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param force? integer|boolean Time in milliseconds to wait"...
comment
-- "--"
comment_content "- a shutdown. If false, only r"...
comment
-- "--"
comment_content "- server to shutdown, but don'"...
comment
-- "--"
comment_content "- true, force a shutdown immed"...
comment
-- "--"
comment_content "- (default: `self.exit_timeout"...
function_declaration (+275 nodes collapsed)
comment
-- "--"
comment_content "- Stops a client, then starts a new client with the same con"...
comment
-- "--"
comment_content "- buffers."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param force? integer|boolean See [Client:stop()] for deta"...
comment
-- "--"
comment_content "- (default: `self.exit_timeout"...
function_declaration (+163 nodes collapsed)
comment
-- "--"
comment_content "- Get options for a method that is registered dynamically."
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method | vim.lsp.protocol.M"...
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_supports_registration"
parameters
( "("
identifier "method"
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability_path"
= "="
expression_list
binary_expression
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_client_capability"
[ "[" all 1:2
identifier "method"
] "]" all 1:2
or "or"
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content " dynamicRegistration is at the second level, even in deeply "...
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability"
= "="
expression_list
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "capabilities"
, ","
bracket_index_expression
identifier "capability_path" all 2:1
[ "["
number "1"
] "]"
, ","
bracket_index_expression
identifier "capability_path" all 2:1
[ "["
number "2"
] "]"
) ")"
return_statement (+21 nodes collapsed)
end "end"
comment
-- "--"
comment_content "- Get provider for a method to be registered dynamically."
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method | vim.lsp.protocol.M"...
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_registration_provider"
parameters
( "("
identifier "method"
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability_path"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
return_statement
return "return"
expression_list
binary_expression any 2:1
binary_expression any 2:1
identifier "capability_path"
and "and"
bracket_index_expression
identifier "capability_path"
[ "["
number "1"
] "]"
or "or"
identifier "method"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param registrations lsp.Registration[]"
function_declaration (+109 nodes collapsed)
comment
-- "--"
comment_content "- @param registrations lsp.Registration[]"
function_declaration (+193 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param unregistrations lsp.Unregistration[]"
function_declaration (+117 nodes collapsed)
comment
-- "--"
comment_content "- @param unregistrations lsp.Unregistration[]"
function_declaration (+71 nodes collapsed)
comment
-- "--"
comment_content "- @private"
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content "- @param provider string"
comment
-- "--"
comment_content "- @param bufnr? integer"
comment
-- "--"
comment_content "- @return lsp.Registration[]?"
function_declaration (+354 nodes collapsed)
comment
-- "--"
comment_content "- Checks whether a client is stopped."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @return boolean # true if client is stopped or in the proc"...
comment
-- "--"
comment_content "- stopped; false otherwise"
function_declaration (+31 nodes collapsed)
comment
-- "--"
comment_content "- Execute a lsp command, either via client command function "...
comment
-- "--"
comment_content "- or via workspace/executeCommand (if supported by the serve"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param command lsp.Command"
comment
-- "--"
comment_content "- @param context? {bufnr?: integer}"
comment
-- "--"
comment_content "- @param handler? lsp.Handler only called if a server comman"...
function_declaration (+280 nodes collapsed)
comment
-- "--"
comment_content "- Default handler for the 'textDocument/didOpen' LSP notific"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param bufnr integer Number of the buffer, or 0 for curren"...
function_declaration (+213 nodes collapsed)
comment
-- "--"
comment_content "- Runs the on_attach function from the client's config if it"...
comment
-- "--"
comment_content "- Useful for buffer-local setup."
comment
-- "--"
comment_content "- @param bufnr integer Buffer number"
function_declaration (+290 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Logs the given error to the LSP log and to the error buffe"...
comment
-- "--"
comment_content "- @param code integer Error code"
comment
-- "--"
comment_content "- @param err any Error arguments"
function_declaration (+93 nodes collapsed)
comment
-- "--"
comment_content "- Checks if a client supports a given method."
comment
-- "--"
comment_content "- Always returns true for unknown off-spec methods."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Note: Some language server capabilities can be file specif"...
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer | vim"...
comment
-- "--"
comment_content "- @param bufnr? integer"
comment
-- "--"
comment_content "- @return boolean"
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "supports_method"
parameters
( "("
identifier "method"
, ","
identifier "bufnr"
) ")"
comment
-- "--"
comment_content " Deprecated form"
block
if_statement (+29 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "required_capability"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
if_statement (+31 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "provider"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_registration_provider"
arguments
( "("
identifier "method"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "regs"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_get_registrations"
arguments
( "("
identifier "provider"
, ","
identifier "bufnr"
) ")"
if_statement
if "if"
binary_expression
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_allows_registration"
[ "["
identifier "method"
] "]"
and "and"
unary_expression
not "not"
identifier "regs"
then "then"
block
return_statement
return "return"
expression_list
false "false"
end "end"
if_statement
if "if"
identifier "regs"
then "then"
block
for_statement
for "for"
for_generic_clause
variable_list
identifier "_"
, ","
identifier "reg"
in "in"
expression_list
function_call
identifier "ipairs"
arguments
( "("
binary_expression
identifier "regs"
or "or"
table_constructor
{ "{"
} "}"
) ")"
do "do"
block
if_statement
if "if"
binary_expression
identifier "required_capability"
and "and"
binary_expression
unary_expression
# "#"
identifier "required_capability"
> ">"
number "1"
then "then"
block
if_statement (+43 nodes collapsed)
else_statement
else "else"
block
return_statement
return "return"
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_supports_registration"
arguments
( "("
dot_index_expression
identifier "reg"
. "."
identifier "method"
) ")"
end "end"
end "end"
return_statement
return "return"
expression_list
false "false"
end "end"
comment
-- "--"
comment_content " if we don't know about the method, assume that the client s"...
comment
-- "--"
comment_content " This needs to be at the end, so that dynamic_capabilities a"...
return_statement
return "return"
expression_list
binary_expression
identifier "required_capability"
== "=="
nil "nil"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Handles a notification sent by an LSP server by invoking t"...
comment
-- "--"
comment_content "- corresponding handler."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ServerToClient.Notif"...
comment
-- "--"
comment_content "- @param params table The parameters for that method."
function_declaration (+79 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Handles a request from an LSP server by invoking the corre"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method (vim.lsp.protocol.Method.ServerToClient) LSP"...
comment
-- "--"
comment_content "- @param params (table) The parameters for that method"
comment
-- "--"
comment_content "- @return any result"
comment
-- "--"
comment_content "- @return lsp.ResponseError? error code and message set in c"...
function_declaration (+130 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Invoked when the client operation throws an error."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param code integer Error code"
comment
-- "--"
comment_content "- @param err any Other arguments may be passed depending on "...
comment
-- "--"
comment_content "- @see vim.lsp.rpc.client_errors for possible errors. Use"
comment
-- "--"
comment_content "- `vim.lsp.rpc.client_errors[code]` to get a human-friendly "...
function_declaration (+113 nodes collapsed)
comment
-- "--"
comment_content "-@param bufnr integer resolved buffer"
function_declaration (+336 nodes collapsed)
comment
-- "--"
comment_content "- Reset defaults set by `set_defaults`."
comment
-- "--"
comment_content "- Must only be called if the last client attached to a buffe"...
function_declaration (+236 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Invoked on client exit."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param code integer) exit code of the process"
comment
-- "--"
comment_content "- @param signal integer the signal used to terminate (if any"...
function_declaration (+340 nodes collapsed)
comment
-- "--"
comment_content "- Add a directory to the workspace folders."
comment
-- "--"
comment_content "- @param dir string?"
function_declaration (+154 nodes collapsed)
comment
-- "--"
comment_content "- Remove a directory to the workspace folders."
comment
-- "--"
comment_content "- @param dir string?"
function_declaration (+115 nodes collapsed)
comment
-- "--"
comment_content " Export for internal use only."
assignment_statement
variable_list
dot_index_expression
identifier "Client"
. "."
identifier "_all"
= "="
expression_list
identifier "all_clients"
return_statement
return "return"
expression_list
identifier "Client"

After

chunk
variable_declaration
local "local"
assignment_statement
variable_list
identifier "uv"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "uv"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "api"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "api"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "lsp"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "lsp"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "log"
= "="
expression_list
dot_index_expression
identifier "lsp"
. "."
identifier "log"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "changetracking"
= "="
expression_list
dot_index_expression
identifier "lsp"
. "."
identifier "_changetracking"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "validate"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "validate"
comment
-- "--"
comment_content "- Tracks all clients initialized."
comment
-- "--"
comment_content "-@type table<integer,vim.lsp.Client>"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "all_clients"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_init_cb fun(client: vim.lsp.Clien"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_attach_cb fun(client: vim.lsp.Cli"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.on_exit_cb fun(code: integer, signal"...
comment
-- "--"
comment_content "- @alias vim.lsp.client.before_init_cb fun(params: lsp.Initi"...
comment
-- "--"
comment_content "- @class vim.lsp.Client.Flags"
comment
-- "--"
comment_content "- @inlinedoc"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Allow using incremental sync for buffer edits"
comment
-- "--"
comment_content "- (default: `true`)"
comment
-- "--"
comment_content "- @field allow_incremental_sync? boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Debounce `didChange` notifications to the server by the gi"...
comment
-- "--"
comment_content "- (default: `150`)"
comment
-- "--"
comment_content "- @field debounce_text_changes? integer"
comment
-- "--"
comment_content "- @class vim.lsp.ClientConfig"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback which can modify parameters before they are sent "...
comment
-- "--"
comment_content "- \"initialize\" phase (after `cmd` is invoked), where `params"...
comment
-- "--"
comment_content "- server and `config` is the config passed to |vim.lsp.start"...
comment
-- "--"
comment_content "- @field before_init? fun(params: lsp.InitializeParams, conf"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map overriding the default capabilities defined by |vim.ls"...
comment
-- "--"
comment_content "- passed to the language server on initialization. Hint: use"...
comment
-- "--"
comment_content "- its result."
comment
-- "--"
comment_content "- - Note: To send an empty dictionary use |vim.empty_dict()|"...
comment
-- "--"
comment_content "- array."
comment
-- "--"
comment_content "- @field capabilities? lsp.ClientCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Command `string[]` that launches the language server (trea"...
comment
-- "--"
comment_content "- absolute or on `$PATH`, shell constructs like \"~\" are not "...
comment
-- "--"
comment_content "- RPC client. Function receives a `dispatchers` table and th"...
comment
-- "--"
comment_content "- a table with member functions `request`, `notify`, `is_clo"...
comment
-- "--"
comment_content "- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|."
comment
-- "--"
comment_content "- For TCP there is a builtin RPC client factory: |vim.lsp.rp"...
comment
-- "--"
comment_content "- @field cmd string[]|fun(dispatchers: vim.lsp.rpc.Dispatche"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Directory to launch the `cmd` process. Not related to `roo"...
comment
-- "--"
comment_content "- (default: cwd)"
comment
-- "--"
comment_content "- @field cmd_cwd? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Environment variables passed to the LSP process on spawn. "...
comment
-- "--"
comment_content "- string."
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- ```lua"
comment
-- "--"
comment_content "- { PORT = 8080; HOST = '0.0.0.0'; }"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- @field cmd_env? table"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of client-defined commands overriding the global |vim."...
comment
-- "--"
comment_content "- @field commands? table<string,fun(command: lsp.Command, ct"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Daemonize the server process so that it runs in a separate"...
comment
-- "--"
comment_content "- Nvim will shutdown the process on exit, but if Nvim fails "...
comment
-- "--"
comment_content "- behind orphaned server processes."
comment
-- "--"
comment_content "- (default: `true`)"
comment
-- "--"
comment_content "- @field detached? boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Milliseconds to wait for server to exit cleanly after send"...
comment
-- "--"
comment_content "- sending kill -15. If set to false, waits indefinitely. If "...
comment
-- "--"
comment_content "- server immediately."
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field exit_timeout? integer|boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Experimental client flags:"
comment
-- "--"
comment_content "- @field flags? vim.lsp.Client.Flags"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Language ID as string. Defaults to the buffer filetype."
comment
-- "--"
comment_content "- @field get_language_id? fun(bufnr: integer, filetype: stri"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of LSP method names to |lsp-handler|s."
comment
-- "--"
comment_content "- @field handlers? table<string,function>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Values to pass in the initialization request as `initializ"...
comment
-- "--"
comment_content "- the LSP spec."
comment
-- "--"
comment_content "- @field init_options? lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Name in logs and user messages."
comment
-- "--"
comment_content "- (default: client-id)"
comment
-- "--"
comment_content "- @field name? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Called \"position encoding\" in LSP spec. The encoding that "...
comment
-- "--"
comment_content "- communication. Not validated. Can be modified in `on_init`"...
comment
-- "--"
comment_content "- @field offset_encoding? 'utf-8'|'utf-16'|'utf-32'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked when client attaches to a buffer."
comment
-- "--"
comment_content "- @field on_attach? elem_or_list<fun(client: vim.lsp.Client,"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked when the client operation throws an error"...
comment
-- "--"
comment_content "- Other arguments may be passed depending on the error kind."...
comment
-- "--"
comment_content "- for possible errors. Use `vim.lsp.rpc.client_errors[code]`"...
comment
-- "--"
comment_content "- @field on_error? fun(code: integer, err: string)"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked on client exit."
comment
-- "--"
comment_content "- - code: exit code of the process"
comment
-- "--"
comment_content "- - signal: number describing the signal used to terminate"...
comment
-- "--"
comment_content "- - client_id: client handle"
comment
-- "--"
comment_content "- @field on_exit? elem_or_list<fun(code: integer, signal: in"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Callback invoked after LSP \"initialize\", where `result` is"...
comment
-- "--"
comment_content "- anything else the server may send. For example, clangd sen"...
comment
-- "--"
comment_content "- `capabilities.offsetEncoding` was sent to it. You can only"...
comment
-- "--"
comment_content "- here before any notifications are sent."
comment
-- "--"
comment_content "- @field on_init? elem_or_list<fun(client: vim.lsp.Client, i"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Directory where the LSP server will base its workspaceFold"...
comment
-- "--"
comment_content "- @field root_dir? string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Map of language server-specific settings, decided by the c"...
comment
-- "--"
comment_content "- `workspace/configuration`. Keys are case-sensitive."
comment
-- "--"
comment_content "- @field settings? lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Passed directly to the language server in the initialize r"...
comment
-- "--"
comment_content "- (default: \"off\")"
comment
-- "--"
comment_content "- @field trace? 'off'|'messages'|'verbose'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- List of workspace folders passed to the language server. F"...
comment
-- "--"
comment_content "- rootPath are derived from the first workspace folder in th"...
comment
-- "--"
comment_content "- supports workspace folders but none are configured. See `w"...
comment
-- "--"
comment_content "- @field workspace_folders? lsp.WorkspaceFolder[]"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Server requires a workspace (no \"single file\" support). No"...
comment
-- "--"
comment_content "- a workspace, cross-file features (navigation, hover) may o"...
comment
-- "--"
comment_content "- language server, even if the server doesn't require a work"...
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field workspace_required? boolean"
comment
-- "--"
comment_content "- @class vim.lsp.Client.Progress: vim.Ringbuf<{token: intege"...
comment
-- "--"
comment_content "- @field pending table<lsp.ProgressToken,lsp.LSPAny>"
comment
-- "--"
comment_content "- @class vim.lsp.Client"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field attached_buffers table<integer,true>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Capabilities provided by the client (editor or tool), at s"...
comment
-- "--"
comment_content "- @field capabilities lsp.ClientCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Client commands. See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field commands table<string,fun(command: lsp.Command, ctx"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Copy of the config passed to |vim.lsp.start()|."
comment
-- "--"
comment_content "- @field config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Capabilities provided at runtime (after startup)."
comment
-- "--"
comment_content "- @field dynamic_capabilities lsp.DynamicCapabilities"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Milliseconds to wait for server to exit cleanly after send"...
comment
-- "--"
comment_content "- sending kill -15. If set to false, waits indefinitely. If "...
comment
-- "--"
comment_content "- server immediately."
comment
-- "--"
comment_content "- (default: `false`)"
comment
-- "--"
comment_content "- @field exit_timeout integer|boolean"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Experimental client flags:"
comment
-- "--"
comment_content "- @field flags vim.lsp.Client.Flags"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field get_language_id fun(bufnr: integer, filetype: strin"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field handlers table<string,lsp.Handler>"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The id allocated to the client."
comment
-- "--"
comment_content "- @field id integer"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field initialized true?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field name string"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field offset_encoding 'utf-8'|'utf-16'|'utf-32'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- A ring buffer (|vim.ringbuf()|) containing progress messag"...
comment
-- "--"
comment_content "- sent by the server."
comment
-- "--"
comment_content "- @field progress vim.lsp.Client.Progress"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The current pending requests in flight to the server. Entr"...
comment
-- "--"
comment_content "- pairs with the key being the request id while the value is"...
comment
-- "--"
comment_content "- `type`, `bufnr`, and `method` key-value pairs. `type` is e"...
comment
-- "--"
comment_content "- for an active request, or \"cancel\" for a cancel request. I"...
comment
-- "--"
comment_content "- \"complete\" ephemerally while executing |LspRequest| autocm"...
comment
-- "--"
comment_content "- are received from the server."
comment
-- "--"
comment_content "- @field requests table<integer,{ type: string, bufnr: integ"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field root_dir string?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- RPC client object, for low level interaction with the clie"...
comment
-- "--"
comment_content "- See |vim.lsp.rpc.start()|."
comment
-- "--"
comment_content "- @field rpc vim.lsp.rpc.PublicClient"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Response from the server sent on `initialize` describing t"...
comment
-- "--"
comment_content "- @field server_capabilities lsp.ServerCapabilities?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Response from the server sent on `initialize` describing s"...
comment
-- "--"
comment_content "- @field server_info lsp.ServerInfo?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field settings lsp.LSPObject"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- See [vim.lsp.ClientConfig]."
comment
-- "--"
comment_content "- @field workspace_folders lsp.WorkspaceFolder[]?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field _enabled_capabilities table<vim.lsp.capability.Name"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Whether on-type formatting is enabled for this client."
comment
-- "--"
comment_content "- @field _otf_enabled boolean?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Timer for stop() with timeout."
comment
-- "--"
comment_content "- @field private _shutdown_timer uv.uv_timer_t?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Track this so that we can escalate automatically if we've "...
comment
-- "--"
comment_content "- graceful shutdown"
comment
-- "--"
comment_content "- @field private _graceful_shutdown_failed true?"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- The initial trace setting. If omitted trace is disabled (\""...
comment
-- "--"
comment_content "- trace = \"off\" | \"messages\" | \"verbose\";"
comment
-- "--"
comment_content "- @field private _trace 'off'|'messages'|'verbose'"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @field private registrations table<string,lsp.Registration"...
comment
-- "--"
comment_content "- @field private _log_prefix string"
comment
-- "--"
comment_content "- @field private _before_init_cb? vim.lsp.client.before_init"...
comment
-- "--"
comment_content "- @field private _on_attach_cbs vim.lsp.client.on_attach_cb["...
comment
-- "--"
comment_content "- @field private _on_init_cbs vim.lsp.client.on_init_cb[]"
comment
-- "--"
comment_content "- @field private _on_exit_cbs vim.lsp.client.on_exit_cb[]"
comment
-- "--"
comment_content "- @field private _on_error_cb? fun(code: integer, err: strin"...
variable_declaration
local "local"
assignment_statement
variable_list
identifier "Client"
= "="
expression_list
table_constructor
{ "{"
} "}"
assignment_statement
variable_list
dot_index_expression
identifier "Client"
. "."
identifier "__index"
= "="
expression_list
identifier "Client"
comment
-- "--"
comment_content "- @param obj table<string,any>"
comment
-- "--"
comment_content "- @param cls table<string,function>"
comment
-- "--"
comment_content "- @param name string"
function_declaration (+134 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "client_index"
= "="
expression_list
number "0"
comment
-- "--"
comment_content "- Checks whether a given path is a directory."
comment
-- "--"
comment_content "- @param filename (string) path to check"
comment
-- "--"
comment_content "- @return boolean # true if {filename} exists and is a direc"...
function_declaration (+61 nodes collapsed)
variable_declaration (+88 nodes collapsed)
comment
-- "--"
comment_content "- Normalizes {encoding} to valid LSP encoding names."
comment
-- "--"
comment_content "- @param encoding string? Encoding to normalize"
comment
-- "--"
comment_content "- @return string # normalized encoding name"
function_declaration (+79 nodes collapsed)
comment
-- "--"
comment_content "- Augments a validator function with support for optional (n"...
comment
-- "--"
comment_content "- @param fn (fun(v): boolean) The original validator functio"...
comment
-- "--"
comment_content "- bool."
comment
-- "--"
comment_content "- @return fun(v): boolean # The augmented function. Also ret"...
comment
-- "--"
comment_content "- `nil`."
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content "- By default, get_language_id just returns the exact filetyp"...
comment
-- "--"
comment_content "- It is possible to pass in something that will calculate a "...
comment
-- "--"
comment_content "- to be sent by the client."
comment
-- "--"
comment_content "- @param _bufnr integer"
comment
-- "--"
comment_content "- @param filetype string"
function_declaration
local "local"
function "function"
identifier "default_get_language_id"
parameters
( "("
identifier "_bufnr"
, ","
identifier "filetype"
) ")"
block
return_statement
return "return"
expression_list
identifier "filetype"
end "end"
comment
-- "--"
comment_content "- Validates a client configuration as given to |vim.lsp.star"...
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
function_declaration (+488 nodes collapsed)
comment
-- "--"
comment_content "- @param trace string"
comment
-- "--"
comment_content "- @return 'off'|'messages'|'verbose'"
function_declaration (+61 nodes collapsed)
comment
-- "--"
comment_content "- @param id integer"
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "- @return string"
function_declaration (+99 nodes collapsed)
comment
-- "--"
comment_content "- @nodoc"
comment
-- "--"
comment_content "- @param config vim.lsp.ClientConfig"
comment
-- "--"
comment_content "- @return vim.lsp.Client?"
function_declaration (+973 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param cbs function[]"
comment
-- "--"
comment_content "- @param error_id integer"
comment
-- "--"
comment_content "- @param ... any"
function_declaration (+73 nodes collapsed)
comment
-- "--"
comment_content "- @nodoc"
function_declaration (+676 nodes collapsed)
comment
-- "--"
comment_content "- @private"
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_process_static_registrations"
parameters
( "("
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "static_registrations"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "-@type lsp.Registration[]"
for_statement
for "for"
for_generic_clause
variable_list
identifier "method"
in "in"
expression_list
function_call
identifier "pairs"
arguments
( "("
dot_index_expression all 1:2
dot_index_expression all 1:2
identifier "lsp" all 1:2
. "." all 1:2
identifier "protocol" all 1:2
. "." all 1:2
identifier "_method_supports_static_registration"
) ")"
do "do"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability"
= "="
expression_list
bracket_index_expression
dot_index_expression all 1:2
dot_index_expression all 1:2
identifier "lsp" all 1:2
. "." all 1:2
identifier "protocol" all 1:2
. "." all 1:2
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
if_statement
if "if"
binary_expression
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "server_capabilities"
, ","
bracket_index_expression
identifier "capability"
[ "["
number "1"
] "]"
, ","
string
' "'"
string_content "id"
' "'"
) ")"
and "and"
function_call
method_index_expression
identifier "self"
: ":"
identifier "_supports_registration"
arguments
( "("
identifier "method"
) ")"
then "then"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "cap"
= "="
expression_list
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "server_capabilities"
, ","
bracket_index_expression
identifier "capability"
[ "["
number "1"
] "]"
) ")"
assignment_statement
variable_list
bracket_index_expression
identifier "static_registrations"
[ "["
binary_expression
unary_expression
# "#"
identifier "static_registrations"
+ "+"
number "1"
] "]"
= "="
expression_list
table_constructor
{ "{"
field
identifier "id"
= "="
dot_index_expression
identifier "cap"
. "."
identifier "id"
, ","
field
identifier "method"
= "="
identifier "method"
, ","
field
identifier "registerOptions"
= "="
binary_expression
identifier "cap"
or "or"
table_constructor
{ "{"
} "}"
, ","
} "}"
end "end"
end "end"
if_statement
if "if"
function_call
identifier "next"
arguments
( "("
identifier "static_registrations"
) ")"
then "then"
block
function_call
method_index_expression
identifier "self"
: ":"
identifier "_register_dynamic"
arguments
( "("
identifier "static_registrations"
) ")"
end "end"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Returns the handler associated with an LSP method."
comment
-- "--"
comment_content "- Returns the default handler if the user hasn't set a custo"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method (vim.lsp.protocol.Method) LSP method name"
comment
-- "--"
comment_content "- @return lsp.Handler? handler for the given method, if defi"...
function_declaration (+33 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param id integer"
comment
-- "--"
comment_content "- @param req_type 'pending'|'complete'|'cancel'"
comment
-- "--"
comment_content "- @param bufnr? integer (only required for req_type='pending"...
comment
-- "--"
comment_content "- @param method? vim.lsp.protocol.Method (only required for "...
function_declaration (+339 nodes collapsed)
comment
-- "--"
comment_content "- Sends a request to the server."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- This is a thin wrapper around {client.rpc.request} with so"...
comment
-- "--"
comment_content "- checks for capabilities and handler availability."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Reque"...
comment
-- "--"
comment_content "- @param params? table LSP request params."
comment
-- "--"
comment_content "- @param handler? lsp.Handler Response |lsp-handler| for thi"...
comment
-- "--"
comment_content "- @param bufnr? integer (default: 0) Buffer handle, or 0 for"...
comment
-- "--"
comment_content "- @return boolean status indicates whether the request was s"...
comment
-- "--"
comment_content "- If it is `false`, then it will always be `false` (the "...
comment
-- "--"
comment_content "- @return integer? request_id Can be used with |Client:cance"...
comment
-- "--"
comment_content "- `nil` is request failed."
comment
-- "--"
comment_content "- to cancel the-request."
comment
-- "--"
comment_content "- @see |vim.lsp.buf_request_all()|"
function_declaration (+326 nodes collapsed)
comment
-- "--"
comment_content " TODO(lewis6991): duplicated from lsp.lua"
variable_declaration (+45 nodes collapsed)
comment
-- "--"
comment_content "- Concatenates and writes a list of strings to the Vim error"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param ... string List to write to the buffer"
function_declaration (+153 nodes collapsed)
comment
-- "--"
comment_content "- Sends a request to the server and synchronously waits for "...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- This is a wrapper around |Client:request()|"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Reque"...
comment
-- "--"
comment_content "- @param params table LSP request params."
comment
-- "--"
comment_content "- @param timeout_ms integer? Maximum time in milliseconds to"...
comment
-- "--"
comment_content "- a result. Defaults to 1000"
comment
-- "--"
comment_content "- @param bufnr? integer (default: 0) Buffer handle, or 0 for"...
comment
-- "--"
comment_content "- @return {err: lsp.ResponseError?, result:any}? `result` an"...
comment
-- "--"
comment_content "- `nil` is the request was unsuccessful"
comment
-- "--"
comment_content "- @return string? err On timeout, cancel or error, where `er"...
comment
-- "--"
comment_content "- string describing the failure reason."
comment
-- "--"
comment_content "- @see |vim.lsp.buf_request_sync()|"
function_declaration (+166 nodes collapsed)
comment
-- "--"
comment_content "- Sends a notification to an LSP server."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer.Notif"...
comment
-- "--"
comment_content "- @param params table? LSP request params."
comment
-- "--"
comment_content "- @return boolean status indicating if the notification was "...
comment
-- "--"
comment_content "- If it is false, then the client has"...
function_declaration (+127 nodes collapsed)
comment
-- "--"
comment_content "- Cancels a request with a given request id."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param id integer id of request to cancel"
comment
-- "--"
comment_content "- @return boolean status indicating if the notification was "...
comment
-- "--"
comment_content "- @see |Client:notify()|"
function_declaration (+52 nodes collapsed)
comment
-- "--"
comment_content "- Stops a client, optionally with force after a timeout."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- By default, it will request the server to shutdown, then f"...
comment
-- "--"
comment_content "- if the server has not exited after `self.exit_timeout` mil"...
comment
-- "--"
comment_content "- you request to stop a client which has previously been req"...
comment
-- "--"
comment_content "- shutdown, it will automatically escalate and force shutdow"...
comment
-- "--"
comment_content "- regardless of the value of `force` (or `self.exit_timeout`"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Note: Forcing shutdown while a server is busy writing out "...
comment
-- "--"
comment_content "- files can lead to file corruption."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param force? integer|boolean Time in milliseconds to wait"...
comment
-- "--"
comment_content "- a shutdown. If false, only r"...
comment
-- "--"
comment_content "- server to shutdown, but don'"...
comment
-- "--"
comment_content "- true, force a shutdown immed"...
comment
-- "--"
comment_content "- (default: `self.exit_timeout"...
function_declaration (+275 nodes collapsed)
comment
-- "--"
comment_content "- Stops a client, then starts a new client with the same con"...
comment
-- "--"
comment_content "- buffers."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param force? integer|boolean See [Client:stop()] for deta"...
comment
-- "--"
comment_content "- (default: `self.exit_timeout"...
function_declaration (+163 nodes collapsed)
comment
-- "--"
comment_content "- Get options for a method that is registered dynamically."
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method | vim.lsp.protocol.M"...
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_supports_registration"
parameters
( "("
identifier "method"
) ")"
block
if_statement
if "if"
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_methods_with_no_registration_options"
[ "[" all 1:2
identifier "method"
] "]" all 1:2
then "then"
block
return_statement
return "return"
expression_list
true "true"
end "end"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "provider"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_registration_provider"
arguments
( "("
identifier "method"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability_path"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_provider_to_client_registration"
[ "[" all 1:2
identifier "provider"
] "]" all 1:2
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability"
= "="
expression_list
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "capabilities"
, ","
function_call
identifier "unpack"
arguments
( "("
identifier "capability_path" all 2:1
) ")"
) ")"
return_statement (+21 nodes collapsed)
end "end"
comment
-- "--"
comment_content "- Get provider for a method to be registered dynamically."
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method | vim.lsp.protocol.M"...
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_registration_provider"
parameters
( "("
identifier "method"
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "capability_path"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
return_statement
return "return"
expression_list
binary_expression any 2:1
identifier "capability_path"
and "and"
bracket_index_expression
identifier "capability_path"
[ "["
number "1"
] "]"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param registrations lsp.Registration[]"
function_declaration (+109 nodes collapsed)
comment
-- "--"
comment_content "- @param registrations lsp.Registration[]"
function_declaration (+193 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- @param unregistrations lsp.Unregistration[]"
function_declaration (+117 nodes collapsed)
comment
-- "--"
comment_content "- @param unregistrations lsp.Unregistration[]"
function_declaration (+71 nodes collapsed)
comment
-- "--"
comment_content "- @private"
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content "- @param provider string"
comment
-- "--"
comment_content "- @param bufnr? integer"
comment
-- "--"
comment_content "- @return lsp.Registration[]?"
function_declaration (+354 nodes collapsed)
comment
-- "--"
comment_content "- Checks whether a client is stopped."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @return boolean # true if client is stopped or in the proc"...
comment
-- "--"
comment_content "- stopped; false otherwise"
function_declaration (+31 nodes collapsed)
comment
-- "--"
comment_content "- Execute a lsp command, either via client command function "...
comment
-- "--"
comment_content "- or via workspace/executeCommand (if supported by the serve"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param command lsp.Command"
comment
-- "--"
comment_content "- @param context? {bufnr?: integer}"
comment
-- "--"
comment_content "- @param handler? lsp.Handler only called if a server comman"...
function_declaration (+280 nodes collapsed)
comment
-- "--"
comment_content "- Default handler for the 'textDocument/didOpen' LSP notific"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param bufnr integer Number of the buffer, or 0 for curren"...
function_declaration (+213 nodes collapsed)
comment
-- "--"
comment_content "- Runs the on_attach function from the client's config if it"...
comment
-- "--"
comment_content "- Useful for buffer-local setup."
comment
-- "--"
comment_content "- @param bufnr integer Buffer number"
function_declaration (+290 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Logs the given error to the LSP log and to the error buffe"...
comment
-- "--"
comment_content "- @param code integer Error code"
comment
-- "--"
comment_content "- @param err any Error arguments"
function_declaration (+93 nodes collapsed)
comment
-- "--"
comment_content "- Checks if a client supports a given method."
comment
-- "--"
comment_content "- Always returns true for unknown off-spec methods."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Note: Some language server capabilities can be file specif"...
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer | vim"...
comment
-- "--"
comment_content "- @param bufnr? integer"
comment
-- "--"
comment_content "- @return boolean"
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "supports_method"
parameters
( "("
identifier "method"
, ","
identifier "bufnr"
) ")"
comment
-- "--"
comment_content " Deprecated form"
block
if_statement (+29 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "required_capability"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
if_statement (+31 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "provider"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_registration_provider"
arguments
( "("
identifier "method"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "regs"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_get_registrations"
arguments
( "("
identifier "provider"
, ","
identifier "bufnr"
) ")"
if_statement
if "if"
binary_expression
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_method_supports_dynamic_registration"
[ "["
identifier "method"
] "]"
and "and"
unary_expression
not "not"
identifier "regs"
then "then"
block
return_statement
return "return"
expression_list
false "false"
end "end"
if_statement
if "if"
identifier "regs"
then "then"
block
for_statement
for "for"
for_generic_clause
variable_list
identifier "_"
, ","
identifier "reg"
in "in"
expression_list
function_call
identifier "ipairs"
arguments
( "("
binary_expression
identifier "regs"
or "or"
table_constructor
{ "{"
} "}"
) ")"
do "do"
block
if_statement
if "if"
binary_expression
identifier "required_capability"
and "and"
binary_expression
unary_expression
# "#"
identifier "required_capability"
> ">"
number "1"
then "then"
block
if_statement (+43 nodes collapsed)
if_statement
if "if"
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_methods_with_no_registration_options"
[ "["
identifier "method"
] "]"
then "then"
block
return_statement
return "return"
expression_list
true "true"
end "end"
else_statement
else "else"
block
return_statement
return "return"
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_supports_registration"
arguments
( "("
dot_index_expression
identifier "reg"
. "."
identifier "method"
) ")"
end "end"
end "end"
return_statement
return "return"
expression_list
false "false"
end "end"
comment
-- "--"
comment_content " if we don't know about the method, assume that the client s"...
comment
-- "--"
comment_content " This needs to be at the end, so that dynamic_capabilities a"...
return_statement
return "return"
expression_list
binary_expression
identifier "required_capability"
== "=="
nil "nil"
end "end"
comment
-- "--"
comment_content "- Retrieves all capability values for a given LSP method, ha"...
comment
-- "--"
comment_content "- This function abstracts over differences between capabilit"...
comment
-- "--"
comment_content "- and those registered dynamically at runtime, returning all"...
comment
-- "--"
comment_content "- It also handles cases where the registration method differ"...
comment
-- "--"
comment_content "- For example, `workspace/diagnostic` uses capabilities regi"...
comment
-- "--"
comment_content "- This is useful for features like diagnostics and formattin"...
comment
-- "--"
comment_content "- with different options (such as specific filetypes or docu"...
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ClientToServer | vim"...
comment
-- "--"
comment_content "- @param ... any Additional keys to index into the capabilit"...
comment
-- "--"
comment_content "- @return lsp.LSPAny[] # The capability value if it exists, "...
function_declaration
function "function"
method_index_expression
identifier "Client"
: ":"
identifier "_provider_value_get"
parameters
( "("
identifier "method"
, ","
vararg_expression "..."
) ")"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "matched_regs"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- @type any[]"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "provider"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_registration_provider"
arguments
( "("
identifier "method"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "dynamic_regs"
= "="
expression_list
function_call
method_index_expression
identifier "self"
: ":"
identifier "_get_registrations"
arguments
( "("
identifier "provider"
) ")"
if_statement
if "if"
unary_expression
not "not"
identifier "provider"
then "then"
block
return_statement
return "return"
expression_list
identifier "matched_regs"
elseif_statement
elseif "elseif"
unary_expression
not "not"
identifier "dynamic_regs"
then "then"
comment
-- "--"
comment_content " First check static capabilities"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "static_reg"
= "="
expression_list
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
dot_index_expression
identifier "self"
. "."
identifier "server_capabilities"
, ","
identifier "provider"
) ")"
if_statement
if "if"
identifier "static_reg"
then "then"
block
assignment_statement
variable_list
bracket_index_expression
identifier "matched_regs"
[ "["
number "1"
] "]"
= "="
expression_list
binary_expression
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
identifier "static_reg"
, ","
vararg_expression "..."
) ")"
or "or"
dot_index_expression
identifier "vim"
. "."
identifier "NIL"
end "end"
else_statement
else "else"
block
variable_declaration
local "local"
assignment_statement
variable_list
identifier "required_capability"
= "="
expression_list
bracket_index_expression
dot_index_expression
dot_index_expression
identifier "lsp"
. "."
identifier "protocol"
. "."
identifier "_request_name_to_server_capability"
[ "["
identifier "method"
] "]"
for_statement
for "for"
for_generic_clause
variable_list
identifier "_"
, ","
identifier "reg"
in "in"
expression_list
function_call
identifier "ipairs"
arguments
( "("
identifier "dynamic_regs"
) ")"
do "do"
block
if_statement
if "if"
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
identifier "reg"
, ","
string
' "'"
string_content "registerOptions"
' "'"
, ","
function_call
identifier "unpack"
arguments
( "("
identifier "required_capability"
, ","
number "2"
) ")"
) ")"
then "then"
block
assignment_statement
variable_list
bracket_index_expression
identifier "matched_regs"
[ "["
binary_expression
unary_expression
# "#"
identifier "matched_regs"
+ "+"
number "1"
] "]"
= "="
expression_list
binary_expression
function_call
dot_index_expression
identifier "vim"
. "."
identifier "tbl_get"
arguments
( "("
identifier "reg"
, ","
string
' "'"
string_content "registerOptions"
' "'"
, ","
vararg_expression "..."
) ")"
or "or"
dot_index_expression
identifier "vim"
. "."
identifier "NIL"
end "end"
end "end"
end "end"
return_statement
return "return"
expression_list
identifier "matched_regs"
end "end"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Handles a notification sent by an LSP server by invoking t"...
comment
-- "--"
comment_content "- corresponding handler."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method vim.lsp.protocol.Method.ServerToClient.Notif"...
comment
-- "--"
comment_content "- @param params table The parameters for that method."
function_declaration (+79 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Handles a request from an LSP server by invoking the corre"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param method (vim.lsp.protocol.Method.ServerToClient) LSP"...
comment
-- "--"
comment_content "- @param params (table) The parameters for that method"
comment
-- "--"
comment_content "- @return any result"
comment
-- "--"
comment_content "- @return lsp.ResponseError? error code and message set in c"...
function_declaration (+130 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Invoked when the client operation throws an error."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param code integer Error code"
comment
-- "--"
comment_content "- @param err any Other arguments may be passed depending on "...
comment
-- "--"
comment_content "- @see vim.lsp.rpc.client_errors for possible errors. Use"
comment
-- "--"
comment_content "- `vim.lsp.rpc.client_errors[code]` to get a human-friendly "...
function_declaration (+113 nodes collapsed)
comment
-- "--"
comment_content "-@param bufnr integer resolved buffer"
function_declaration (+336 nodes collapsed)
comment
-- "--"
comment_content "- Reset defaults set by `set_defaults`."
comment
-- "--"
comment_content "- Must only be called if the last client attached to a buffe"...
function_declaration (+236 nodes collapsed)
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "- Invoked on client exit."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param code integer) exit code of the process"
comment
-- "--"
comment_content "- @param signal integer the signal used to terminate (if any"...
function_declaration (+340 nodes collapsed)
comment
-- "--"
comment_content "- Add a directory to the workspace folders."
comment
-- "--"
comment_content "- @param dir string?"
function_declaration (+154 nodes collapsed)
comment
-- "--"
comment_content "- Remove a directory to the workspace folders."
comment
-- "--"
comment_content "- @param dir string?"
function_declaration (+115 nodes collapsed)
comment
-- "--"
comment_content " Export for internal use only."
assignment_statement
variable_list
dot_index_expression
identifier "Client"
. "."
identifier "_all"
= "="
expression_list
identifier "all_clients"
return_statement
return "return"
expression_list
identifier "Client"