diff options
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index a56e141c29..9a0b3f3100 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -363,7 +363,7 @@ do --- smallest debounce interval is used and we don't group clients by different intervals. --- --- @class CTGroup - --- @field sync_kind number TextDocumentSyncKind, considers config.flags.allow_incremental_sync + --- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync --- @field offset_encoding "utf-8"|"utf-16"|"utf-32" --- --- @class CTBufferState @@ -374,12 +374,12 @@ do --- @field timer nil|uv.uv_timer_t uv_timer --- @field last_flush nil|number uv.hrtime of the last flush/didChange-notification --- @field needs_flush boolean true if buffer updates haven't been sent to clients/servers yet - --- @field refs number how many clients are using this group + --- @field refs integer how many clients are using this group --- --- @class CTGroupState - --- @field buffers table<number, CTBufferState> - --- @field debounce number debounce duration in ms - --- @field clients table<number, table> clients using this state. {client_id, client} + --- @field buffers table<integer, CTBufferState> + --- @field debounce integer debounce duration in ms + --- @field clients table<integer, table> clients using this state. {client_id, client} ---@private ---@param group CTGroup @@ -568,7 +568,7 @@ do -- -- This turns the debounce into a kind of client rate limiting -- - ---@param debounce number + ---@param debounce integer ---@param buf_state CTBufferState ---@return number local function next_debounce(debounce, buf_state) @@ -585,8 +585,8 @@ do end ---@private - ---@param bufnr number - ---@param sync_kind number protocol.TextDocumentSyncKind + ---@param bufnr integer + ---@param sync_kind integer protocol.TextDocumentSyncKind ---@param state CTGroupState ---@param buf_state CTBufferState local function send_changes(bufnr, sync_kind, state, buf_state) @@ -714,7 +714,7 @@ end ---@private --- Default handler for the 'textDocument/didOpen' LSP notification. --- ----@param bufnr number Number of the buffer, or 0 for current +---@param bufnr integer Number of the buffer, or 0 for current ---@param client table Client object local function text_document_did_open_handler(bufnr, client) changetracking.init(client, bufnr) @@ -1095,7 +1095,7 @@ function lsp.start_client(config) ---@private --- Invoked when the client operation throws an error. --- - ---@param code (number) Error code + ---@param code (integer) Error code ---@param err (...) Other arguments may be passed depending on the error kind ---@see `vim.lsp.rpc.client_errors` for possible errors. Use ---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name. @@ -1148,8 +1148,8 @@ function lsp.start_client(config) ---@private --- Invoked on client exit. --- - ---@param code (number) exit code of the process - ---@param signal (number) the signal used to terminate (if any) + ---@param code (integer) exit code of the process + ---@param signal (integer) the signal used to terminate (if any) function dispatch.on_exit(code, signal) if config.on_exit then pcall(config.on_exit, code, signal, client_id) @@ -1414,9 +1414,9 @@ function lsp.start_client(config) --- ---@param method (string) LSP method name. ---@param params (table) LSP request params. - ---@param timeout_ms (number|nil) Maximum time in milliseconds to wait for + ---@param timeout_ms (integer|nil) Maximum time in milliseconds to wait for --- a result. Defaults to 1000 - ---@param bufnr (number) Buffer handle (0 for current). + ---@param bufnr (integer) Buffer handle (0 for current). ---@return {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dictionary, where --- `err` and `result` come from the |lsp-handler|. --- On timeout, cancel or error, returns `(nil, err)` where `err` is a @@ -1465,7 +1465,7 @@ function lsp.start_client(config) ---@private --- Cancels a request with a given request id. --- - ---@param id (number) id of request to cancel + ---@param id (integer) id of request to cancel ---@return boolean status true if notification was successful. false otherwise ---@see |vim.lsp.client.notify()| function client.cancel_request(id) @@ -1622,8 +1622,8 @@ end --- --- Without calling this, the server won't be notified of changes to a buffer. --- ----@param bufnr (number) Buffer handle, or 0 for current ----@param client_id (number) Client id +---@param bufnr (integer) Buffer handle, or 0 for current +---@param client_id (integer) Client id function lsp.buf_attach_client(bufnr, client_id) validate({ bufnr = { bufnr, 'n', true }, @@ -1734,8 +1734,8 @@ end --- Note: While the server is notified that the text document (buffer) --- was closed, it is still able to send notifications should it ignore this notification. --- ----@param bufnr number Buffer handle, or 0 for current ----@param client_id number Client id +---@param bufnr integer Buffer handle, or 0 for current +---@param client_id integer Client id function lsp.buf_detach_client(bufnr, client_id) validate({ bufnr = { bufnr, 'n', true }, @@ -1785,8 +1785,8 @@ end --- Checks if a buffer is attached for a particular client. --- ----@param bufnr (number) Buffer handle, or 0 for current ----@param client_id (number) the client id +---@param bufnr (integer) Buffer handle, or 0 for current +---@param client_id (integer) the client id function lsp.buf_is_attached(bufnr, client_id) return (all_buffer_active_clients[resolve_bufnr(bufnr)] or {})[client_id] == true end @@ -1794,7 +1794,7 @@ end --- Gets a client by id, or nil if the id is invalid. --- The returned client may not yet be fully initialized. --- ----@param client_id number client id +---@param client_id integer client id --- ---@returns |vim.lsp.client| object, or nil function lsp.get_client_by_id(client_id) @@ -1821,7 +1821,7 @@ end --- By default asks the server to shutdown, unless stop was requested --- already for this client, then force-shutdown is attempted. --- ----@param client_id number|table id or |vim.lsp.client| object, or list thereof +---@param client_id integer|table id or |vim.lsp.client| object, or list thereof ---@param force boolean|nil shutdown forcefully function lsp.stop_client(client_id, force) local ids = type(client_id) == 'table' and client_id or { client_id } @@ -1837,8 +1837,8 @@ function lsp.stop_client(client_id, force) end ---@class vim.lsp.get_active_clients.filter ----@field id number|nil Match clients by id ----@field bufnr number|nil match clients attached to the given buffer +---@field id integer|nil Match clients by id +---@field bufnr integer|nil match clients attached to the given buffer ---@field name string|nil match clients by name --- Get active clients. @@ -1932,7 +1932,7 @@ api.nvim_create_autocmd('VimLeavePre', { --- Sends an async request for all active clients attached to the --- buffer. --- ----@param bufnr (number) Buffer handle, or 0 for current. +---@param bufnr (integer) Buffer handle, or 0 for current. ---@param method (string) LSP method name ---@param params table|nil Parameters to send to the server ---@param handler function|nil See |lsp-handler| @@ -1992,7 +1992,7 @@ end ---Parameters are the same as |vim.lsp.buf_request()| but the return result and callback are ---different. --- ----@param bufnr (number) Buffer handle, or 0 for current. +---@param bufnr (integer) Buffer handle, or 0 for current. ---@param method (string) LSP method name ---@param params (table|nil) Parameters to send to the server ---@param callback (function) The callback to call when all requests are finished. @@ -2034,10 +2034,10 @@ end --- Parameters are the same as |vim.lsp.buf_request()| but the return result is --- different. Wait maximum of {timeout_ms} (default 1000) ms. --- ----@param bufnr (number) Buffer handle, or 0 for current. +---@param bufnr (integer) Buffer handle, or 0 for current. ---@param method (string) LSP method name ---@param params (table|nil) Parameters to send to the server ----@param timeout_ms (number|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 --- ---@return table<integer, any>|nil result, string|nil err Map of client_id:request_result. @@ -2106,10 +2106,10 @@ end ---@see |complete-items| ---@see |CompleteDone| --- ----@param findstart number 0 or 1, decides behavior ----@param base number findstart=0, text to match against +---@param findstart integer 0 or 1, decides behavior +---@param base integer findstart=0, text to match against --- ----@returns (number) Decided by {findstart}: +---@returns (integer) Decided by {findstart}: --- - findstart=0: column where the completion starts, or -2 or -3 --- - findstart=1: list of matches (actually just calls |complete()|) function lsp.omnifunc(findstart, base) @@ -2246,7 +2246,7 @@ end ---Checks whether a client is stopped. --- ----@param client_id (number) +---@param client_id (integer) ---@return boolean stopped true if client is stopped, false otherwise. function lsp.client_is_stopped(client_id) return active_clients[client_id] == nil @@ -2255,7 +2255,7 @@ end --- Gets a map of client_id:client pairs for the given buffer, where each value --- is a |vim.lsp.client| object. --- ----@param bufnr (number|nil): Buffer handle, or 0 for current +---@param bufnr (integer|nil): Buffer handle, or 0 for current ---@returns (table) Table of (client_id, client) pairs ---@deprecated Use |vim.lsp.get_active_clients()| instead. function lsp.buf_get_clients(bufnr) @@ -2284,7 +2284,7 @@ lsp.log_levels = log.levels --- ---@see |vim.lsp.log_levels| --- ----@param level (number|string) the case insensitive level name or number +---@param level (integer|string) the case insensitive level name or number function lsp.set_log_level(level) if type(level) == 'string' or type(level) == 'number' then log.set_level(level) @@ -2301,7 +2301,7 @@ end --- Invokes a function for each LSP client attached to a buffer. --- ----@param bufnr number Buffer number +---@param bufnr integer Buffer number ---@param fn function Function to run on each client attached to buffer --- {bufnr}. The function takes the client, client ID, and --- buffer number as arguments. Example: |