mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
docs(lsp): more precise type annotations (#22621)
This commit is contained in:
@@ -676,7 +676,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
|
|||||||
finished. Unlike `buf_request`, this will collect all the
|
finished. Unlike `buf_request`, this will collect all the
|
||||||
responses from each server instead of handling them. A map
|
responses from each server instead of handling them. A map
|
||||||
of client_id:request_result will be provided to the
|
of client_id:request_result will be provided to the
|
||||||
callback
|
callback.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
fun() cancel A function that will cancel all requests
|
fun() cancel A function that will cancel all requests
|
||||||
@@ -697,9 +697,9 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
|
|||||||
result. Defaults to 1000
|
result. Defaults to 1000
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
table<integer, any>|nil result, string|nil err Map of
|
(table) result Map of client_id:request_result.
|
||||||
client_id:request_result. On timeout, cancel or error, returns `(nil,
|
(string|nil) err On timeout, cancel, or error, `err` is a string
|
||||||
err)` where `err` is a string describing the failure reason.
|
describing the failure reason, and `result` is nil.
|
||||||
|
|
||||||
client() *vim.lsp.client*
|
client() *vim.lsp.client*
|
||||||
LSP client object. You can get an active client object via
|
LSP client object. You can get an active client object via
|
||||||
|
@@ -1038,7 +1038,7 @@ function lsp.start_client(config)
|
|||||||
--- Returns the default handler if the user hasn't set a custom one.
|
--- Returns the default handler if the user hasn't set a custom one.
|
||||||
---
|
---
|
||||||
---@param method (string) LSP method name
|
---@param method (string) LSP method name
|
||||||
---@return function|nil The handler for the given method, if defined, or the default from |vim.lsp.handlers|
|
---@return lsp-handler|nil The handler for the given method, if defined, or the default from |vim.lsp.handlers|
|
||||||
local function resolve_handler(method)
|
local function resolve_handler(method)
|
||||||
return handlers[method] or default_handlers[method]
|
return handlers[method] or default_handlers[method]
|
||||||
end
|
end
|
||||||
@@ -1938,7 +1938,7 @@ api.nvim_create_autocmd('VimLeavePre', {
|
|||||||
---@param bufnr (integer) Buffer handle, or 0 for current.
|
---@param bufnr (integer) Buffer handle, or 0 for current.
|
||||||
---@param method (string) LSP method name
|
---@param method (string) LSP method name
|
||||||
---@param params table|nil Parameters to send to the server
|
---@param params table|nil Parameters to send to the server
|
||||||
---@param handler function|nil See |lsp-handler|
|
---@param handler lsp-handler|nil See |lsp-handler|
|
||||||
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
|
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
|
||||||
---
|
---
|
||||||
---@return table<integer, integer>, fun() 2-tuple:
|
---@return table<integer, integer>, fun() 2-tuple:
|
||||||
@@ -1998,9 +1998,10 @@ end
|
|||||||
---@param bufnr (integer) Buffer handle, or 0 for current.
|
---@param bufnr (integer) Buffer handle, or 0 for current.
|
||||||
---@param method (string) LSP method name
|
---@param method (string) LSP method name
|
||||||
---@param params (table|nil) Parameters to send to the server
|
---@param params (table|nil) Parameters to send to the server
|
||||||
---@param callback (function) The callback to call when all requests are finished.
|
---@param callback fun(request_results: table<integer, {error: lsp.ResponseError, result: any}>) (function)
|
||||||
|
--- The callback to call when all requests are finished.
|
||||||
--- Unlike `buf_request`, this will collect all the responses from each server instead of handling them.
|
--- Unlike `buf_request`, this will collect all the responses from each server instead of handling them.
|
||||||
--- A map of client_id:request_result will be provided to the callback
|
--- A map of client_id:request_result will be provided to the callback.
|
||||||
---
|
---
|
||||||
---@return fun() cancel A function that will cancel all requests
|
---@return fun() cancel A function that will cancel all requests
|
||||||
function lsp.buf_request_all(bufnr, method, params, callback)
|
function lsp.buf_request_all(bufnr, method, params, callback)
|
||||||
@@ -2043,9 +2044,8 @@ end
|
|||||||
---@param timeout_ms (integer|nil) Maximum time in milliseconds to wait for a
|
---@param timeout_ms (integer|nil) Maximum time in milliseconds to wait for a
|
||||||
--- result. Defaults to 1000
|
--- result. Defaults to 1000
|
||||||
---
|
---
|
||||||
---@return table<integer, any>|nil result, string|nil err Map of client_id:request_result.
|
---@return table<integer, {err: lsp.ResponseError, result: any}>|nil (table) result Map of client_id:request_result.
|
||||||
--- On timeout, cancel or error, returns `(nil, err)` where `err` is a string describing
|
---@return string|nil err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil.
|
||||||
--- the failure reason.
|
|
||||||
function lsp.buf_request_sync(bufnr, method, params, timeout_ms)
|
function lsp.buf_request_sync(bufnr, method, params, timeout_ms)
|
||||||
local request_results
|
local request_results
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user