aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-03-07 15:17:52 +0900
committerGitHub <noreply@github.com>2023-03-07 07:17:52 +0100
commit706bcab75eaad2c370d61bf828531054439d3a3e (patch)
treeae55f92afbb54348d6a3105a3300921c398ef9ff
parent7a44231832fbeb0fe87553f75519ca46e91cb7ab (diff)
downloadrneovim-706bcab75eaad2c370d61bf828531054439d3a3e.tar.gz
rneovim-706bcab75eaad2c370d61bf828531054439d3a3e.tar.bz2
rneovim-706bcab75eaad2c370d61bf828531054439d3a3e.zip
docs(lsp): change type annotations from number → integer (#22510)
-rw-r--r--runtime/doc/lsp.txt150
-rw-r--r--runtime/lua/vim/lsp.lua72
-rw-r--r--runtime/lua/vim/lsp/_snippet.lua2
-rw-r--r--runtime/lua/vim/lsp/codelens.lua14
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua12
-rw-r--r--runtime/lua/vim/lsp/log.lua4
-rw-r--r--runtime/lua/vim/lsp/rpc.lua16
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua60
-rw-r--r--runtime/lua/vim/lsp/sync.lua6
-rw-r--r--runtime/lua/vim/lsp/util.lua76
10 files changed, 207 insertions, 205 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 0d7e8e7ab4..b73e2958ef 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -629,8 +629,8 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()*
Without calling this, the server won't be notified of changes to a buffer.
Parameters: ~
- • {bufnr} (number) Buffer handle, or 0 for current
- • {client_id} (number) Client id
+ • {bufnr} (integer) Buffer handle, or 0 for current
+ • {client_id} (integer) Client id
buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
Detaches client from the specified buffer. Note: While the server is
@@ -638,15 +638,15 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
send notifications should it ignore this notification.
Parameters: ~
- • {bufnr} (number) Buffer handle, or 0 for current
- • {client_id} (number) Client id
+ • {bufnr} (integer) Buffer handle, or 0 for current
+ • {client_id} (integer) Client id
buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()*
Checks if a buffer is attached for a particular client.
Parameters: ~
- • {bufnr} (number) Buffer handle, or 0 for current
- • {client_id} (number) the client id
+ • {bufnr} (integer) Buffer handle, or 0 for current
+ • {client_id} (integer) the client id
buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()*
Send a notification to a server
@@ -666,7 +666,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
|vim.lsp.buf_request()| but the return result and callback are different.
Parameters: ~
- • {bufnr} (number) Buffer handle, or 0 for current.
+ • {bufnr} (integer) Buffer handle, or 0 for current.
• {method} (string) LSP method name
• {params} (table|nil) Parameters to send to the server
• {callback} (function) The callback to call when all requests are
@@ -687,10 +687,10 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
result is different. Wait maximum of {timeout_ms} (default 1000) ms.
Parameters: ~
- • {bufnr} (number) Buffer handle, or 0 for current.
+ • {bufnr} (integer) Buffer handle, or 0 for current.
• {method} (string) LSP method name
• {params} (table|nil) Parameters to send to the server
- • {timeout_ms} (number|nil) Maximum time in milliseconds to wait for a
+ • {timeout_ms} (integer|nil) Maximum time in milliseconds to wait for a
result. Defaults to 1000
Return: ~
@@ -759,7 +759,7 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped.
Parameters: ~
- • {client_id} (number)
+ • {client_id} (integer)
Return: ~
(boolean) stopped true if client is stopped, false otherwise.
@@ -769,7 +769,7 @@ for_each_buffer_client({bufnr}, {fn})
Invokes a function for each LSP client attached to a buffer.
Parameters: ~
- • {bufnr} (number) Buffer number
+ • {bufnr} (integer) Buffer number
• {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: >lua
@@ -823,7 +823,7 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
not yet be fully initialized.
Parameters: ~
- • {client_id} (number) client id
+ • {client_id} (integer) client id
Return: ~
|vim.lsp.client| object, or nil
@@ -838,11 +838,11 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
Implements 'omnifunc' compatible LSP completion.
Parameters: ~
- • {findstart} (number) 0 or 1, decides behavior
- • {base} (number) findstart=0, text to match against
+ • {findstart} (integer) 0 or 1, decides behavior
+ • {base} (integer) findstart=0, text to match against
Return: ~
- (number) Decided by {findstart}:
+ (integer) Decided by {findstart}:
• findstart=0: column where the completion starts, or -2 or -3
• findstart=1: list of matches (actually just calls |complete()|)
@@ -861,7 +861,7 @@ set_log_level({level}) *vim.lsp.set_log_level()*
Use `lsp.log_levels` for reverse lookup.
Parameters: ~
- • {level} (number|string) the case insensitive level name or number
+ • {level} (integer|string) the case insensitive level name or number
See also: ~
|vim.lsp.log_levels|
@@ -1052,7 +1052,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
for this client, then force-shutdown is attempted.
Parameters: ~
- • {client_id} number|table id or |vim.lsp.client| object, or list
+ • {client_id} integer|table id or |vim.lsp.client| object, or list
thereof
• {force} (boolean|nil) shutdown forcefully
@@ -1326,7 +1326,7 @@ get_namespace({client_id}) *vim.lsp.diagnostic.get_namespace()*
|vim.diagnostic|.
Parameters: ~
- • {client_id} (number) The id of the LSP client
+ • {client_id} (integer) The id of the LSP client
*vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {result}, {ctx}, {config})
@@ -1365,22 +1365,23 @@ clear({client_id}, {bufnr}) *vim.lsp.codelens.clear()*
Clear the lenses
Parameters: ~
- • {client_id} (number|nil) filter by client_id. All clients if nil
- • {bufnr} (number|nil) filter by buffer. All buffers if nil
+ • {client_id} (integer|nil) filter by client_id. All clients if nil
+ • {bufnr} (integer|nil) filter by buffer. All buffers if nil
display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()*
Display the lenses using virtual text
Parameters: ~
• {lenses} (table) of lenses to display (`CodeLens[] | null`)
- • {bufnr} (number)
- • {client_id} (number)
+ • {bufnr} (integer)
+ • {client_id} (integer)
get({bufnr}) *vim.lsp.codelens.get()*
Return all lenses for the given buffer
Parameters: ~
- • {bufnr} (number) Buffer number. 0 can be used for the current buffer.
+ • {bufnr} (integer) Buffer number. 0 can be used for the current
+ buffer.
Return: ~
(table) (`CodeLens[]`)
@@ -1406,8 +1407,8 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
Parameters: ~
• {lenses} (table) of lenses to store (`CodeLens[] | null`)
- • {bufnr} (number)
- • {client_id} (number)
+ • {bufnr} (integer)
+ • {client_id} (integer)
==============================================================================
@@ -1420,7 +1421,7 @@ force_refresh({bufnr}) *vim.lsp.semantic_tokens.force_refresh()*
highlighting (|vim.lsp.semantic_tokens.start()| has been called for it)
Parameters: ~
- • {bufnr} (number|nil) filter by buffer. All buffers if nil, current
+ • {bufnr} (integer|nil) filter by buffer. All buffers if nil, current
buffer if 0
*vim.lsp.semantic_tokens.get_at_pos()*
@@ -1429,16 +1430,16 @@ get_at_pos({bufnr}, {row}, {col})
arguments, returns the token under the cursor.
Parameters: ~
- • {bufnr} (number|nil) Buffer number (0 for current buffer, default)
- • {row} (number|nil) Position row (default cursor position)
- • {col} (number|nil) Position column (default cursor position)
+ • {bufnr} (integer|nil) Buffer number (0 for current buffer, default)
+ • {row} (integer|nil) Position row (default cursor position)
+ • {col} (integer|nil) Position column (default cursor position)
Return: ~
(table|nil) List of tokens at position. Each token has the following
fields:
- • line (number) line number, 0-based
- • start_col (number) start column, 0-based
- • end_col (number) end column, 0-based
+ • line (integer) line number, 0-based
+ • start_col (integer) start column, 0-based
+ • end_col (integer) end column, 0-based
• type (string) token type as string, e.g. "variable"
• modifiers (table) token modifiers as a set. E.g., { static = true,
readonly = true }
@@ -1455,11 +1456,11 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts})
Parameters: ~
• {token} (table) a semantic token, found as `args.data.token` in
|LspTokenUpdate|.
- • {bufnr} (number) the buffer to highlight
- • {client_id} (number) The ID of the |vim.lsp.client|
+ • {bufnr} (integer) the buffer to highlight
+ • {client_id} (integer) The ID of the |vim.lsp.client|
• {hl_group} (string) Highlight group name
• {opts} (table|nil) Optional parameters.
- • priority: (number|nil) Priority for the applied
+ • priority: (integer|nil) Priority for the applied
extmark. Defaults to
`vim.highlight.priorities.semantic_tokens + 3`
@@ -1477,10 +1478,10 @@ start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()*
<
Parameters: ~
- • {bufnr} (number)
- • {client_id} (number)
+ • {bufnr} (integer)
+ • {client_id} (integer)
• {opts} (nil|table) Optional keyword arguments
- • debounce (number, default: 200): Debounce token
+ • debounce (integer, default: 200): Debounce token
requests to the server by the given number in
milliseconds
@@ -1494,8 +1495,8 @@ stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()*
from the buffer.
Parameters: ~
- • {bufnr} (number)
- • {client_id} (number)
+ • {bufnr} (integer)
+ • {client_id} (integer)
==============================================================================
@@ -1550,7 +1551,7 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
Parameters: ~
• {text_document_edit} (table) a `TextDocumentEdit` object
- • {index} (number) Optional index of the edit, if from a
+ • {index} (integer) Optional index of the edit, if from a
list of edits (or nil, if not from a list)
See also: ~
@@ -1562,7 +1563,7 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Parameters: ~
• {text_edits} (table) list of `TextEdit` objects
- • {bufnr} (number) Buffer id
+ • {bufnr} (integer) Buffer id
• {offset_encoding} (string) utf-8|utf-16|utf-32
See also: ~
@@ -1580,14 +1581,14 @@ buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer.
Parameters: ~
- • {bufnr} (number) Buffer id
+ • {bufnr} (integer) Buffer id
*vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer.
Parameters: ~
- • {bufnr} (number) Buffer id
+ • {bufnr} (integer) Buffer id
• {references} (table) List of `DocumentHighlight` objects to
highlight
• {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32".
@@ -1600,14 +1601,14 @@ character_offset({buf}, {row}, {col}, {offset_encoding})
Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
Parameters: ~
- • {buf} (number) buffer number (0 for current)
+ • {buf} (integer) buffer number (0 for current)
• {row} 0-indexed line
• {col} 0-indexed byte offset in line
• {offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to
`offset_encoding` of first client of `buf`
Return: ~
- (number, number) `offset_encoding` index of the character in line
+ (integer, integer) `offset_encoding` index of the character in line
{row} column {col} in buffer {buf}
*vim.lsp.util.convert_input_to_markdown_lines()*
@@ -1662,10 +1663,10 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
Returns indentation size.
Parameters: ~
- • {bufnr} (number|nil) Buffer handle, defaults to current
+ • {bufnr} (integer|nil) Buffer handle, defaults to current
Return: ~
- (number) indentation size
+ (integer) indentation size
See also: ~
'shiftwidth'
@@ -1715,11 +1716,11 @@ make_floating_popup_options({width}, {height}, {opts})
table can be passed to |nvim_open_win()|.
Parameters: ~
- • {width} (number) window width (in character cells)
- • {height} (number) window height (in character cells)
+ • {width} (integer) window width (in character cells)
+ • {height} (integer) window height (in character cells)
• {opts} (table, optional)
- • offset_x (number) offset to add to `col`
- • offset_y (number) offset to add to `row`
+ • offset_x (integer) offset to add to `col`
+ • offset_y (integer) offset to add to `row`
• border (string or table) override `border`
• focusable (string or table) override `focusable`
• zindex (string or table) override `zindex`, defaults to 50
@@ -1748,11 +1749,11 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
similar to |vim.lsp.util.make_range_params()|.
Parameters: ~
- • {start_pos} number[]|nil {row, col} mark-indexed position.
+ • {start_pos} integer[]|nil {row, col} mark-indexed position.
Defaults to the start of the last visual selection.
- • {end_pos} number[]|nil {row, col} mark-indexed position.
+ • {end_pos} integer[]|nil {row, col} mark-indexed position.
Defaults to the end of the last visual selection.
- • {bufnr} (number|nil) buffer handle or 0 for current,
+ • {bufnr} (integer|nil) buffer handle or 0 for current,
defaults to current
• {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
`offset_encoding` of first client of `bufnr`
@@ -1767,7 +1768,7 @@ make_position_params({window}, {offset_encoding})
cursor position.
Parameters: ~
- • {window} (number|nil) window handle or 0 for current,
+ • {window} (integer|nil) window handle or 0 for current,
defaults to current
• {offset_encoding} (string|nil) utf-8|utf-16|utf-32|nil defaults to
`offset_encoding` of first client of buffer of
@@ -1787,7 +1788,7 @@ make_range_params({window}, {offset_encoding})
`textDocument/rangeFormatting`.
Parameters: ~
- • {window} (number|nil) window handle or 0 for current,
+ • {window} (integer|nil) window handle or 0 for current,
defaults to current
• {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
`offset_encoding` of first client of buffer of
@@ -1802,7 +1803,7 @@ make_text_document_params({bufnr})
Creates a `TextDocumentIdentifier` object for the current buffer.
Parameters: ~
- • {bufnr} (number|nil) Buffer handle, defaults to current
+ • {bufnr} (integer|nil) Buffer handle, defaults to current
Return: ~
`TextDocumentIdentifier`
@@ -1827,15 +1828,16 @@ open_floating_preview({contents}, {syntax}, {opts})
• {syntax} (string) of syntax to set for opened buffer
• {opts} (table) with optional fields (additional keys are passed
on to |nvim_open_win()|)
- • height: (number) height of floating window
- • width: (number) width of floating window
+ • height: (integer) height of floating window
+ • width: (integer) width of floating window
• wrap: (boolean, default true) wrap long lines
- • wrap_at: (number) character to wrap at for computing
+ • wrap_at: (integer) character to wrap at for computing
height when wrap is enabled
- • max_width: (number) maximal width of floating window
- • max_height: (number) maximal height of floating window
- • pad_top: (number) number of lines to pad contents at top
- • pad_bottom: (number) number of lines to pad contents at
+ • max_width: (integer) maximal width of floating window
+ • max_height: (integer) maximal height of floating window
+ • pad_top: (integer) number of lines to pad contents at
+ top
+ • pad_bottom: (integer) number of lines to pad contents at
bottom
• focus_id: (string) if a popup with this id is opened,
then focus it
@@ -2008,13 +2010,13 @@ set_level({level}) *vim.lsp.log.set_level()*
Sets the current log level.
Parameters: ~
- • {level} (string|number) One of `vim.lsp.log.levels`
+ • {level} (string|integer) One of `vim.lsp.log.levels`
should_log({level}) *vim.lsp.log.should_log()*
Checks whether the level is sufficient for logging.
Parameters: ~
- • {level} (number) log level
+ • {level} (integer) log level
Return: ~
(bool) true if would log, false if not
@@ -2029,7 +2031,7 @@ connect({host}, {port}) *vim.lsp.rpc.connect()*
Parameters: ~
• {host} (string)
- • {port} (number)
+ • {port} (integer)
Return: ~
(function)
@@ -2074,7 +2076,7 @@ rpc_response_error({code}, {message}, {data})
Creates an RPC response object/table.
Parameters: ~
- • {code} (number) RPC error code defined in
+ • {code} (integer) RPC error code defined in
`vim.lsp.protocol.ErrorCodes`
• {message} (string|nil) arbitrary message to send to server
• {data} any|nil arbitrary data to send to server
@@ -2122,11 +2124,11 @@ compute_diff({___MissingCloseParenHere___})
Parameters: ~
• {prev_lines} (table) list of lines
• {curr_lines} (table) list of lines
- • {firstline} (number) line to begin search for first difference
- • {lastline} (number) line to begin search in old_lines for last
- difference
- • {new_lastline} (number) line to begin search in new_lines for last
- difference
+ • {firstline} (integer) line to begin search for first difference
+ • {lastline} (integer) line to begin search in old_lines for
+ last difference
+ • {new_lastline} (integer) line to begin search in new_lines for
+ last difference
• {offset_encoding} (string) encoding requested by language server
Return: ~
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:
diff --git a/runtime/lua/vim/lsp/_snippet.lua b/runtime/lua/vim/lsp/_snippet.lua
index 3488639fb4..797d8960d5 100644
--- a/runtime/lua/vim/lsp/_snippet.lua
+++ b/runtime/lua/vim/lsp/_snippet.lua
@@ -483,7 +483,7 @@ end)
local M = {}
---The snippet node type enum
----@types table<string, number>
+---@types table<string, integer>
M.NodeType = Node.Type
---Parse snippet string and returns the AST
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index 17489ed84d..81cac6a511 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -61,7 +61,7 @@ end
--- Return all lenses for the given buffer
---
----@param bufnr number Buffer number. 0 can be used for the current buffer.
+---@param bufnr integer Buffer number. 0 can be used for the current buffer.
---@return table (`CodeLens[]`)
function M.get(bufnr)
local lenses_by_client = lens_cache_by_buf[bufnr or 0]
@@ -115,8 +115,8 @@ end
--- Clear the lenses
---
----@param client_id number|nil filter by client_id. All clients if nil
----@param bufnr number|nil filter by buffer. All buffers if nil
+---@param client_id integer|nil filter by client_id. All clients if nil
+---@param bufnr integer|nil filter by buffer. All buffers if nil
function M.clear(client_id, bufnr)
local buffers = bufnr and { resolve_bufnr(bufnr) } or vim.tbl_keys(lens_cache_by_buf)
for _, iter_bufnr in pairs(buffers) do
@@ -132,8 +132,8 @@ end
--- Display the lenses using virtual text
---
---@param lenses table of lenses to display (`CodeLens[] | null`)
----@param bufnr number
----@param client_id number
+---@param bufnr integer
+---@param client_id integer
function M.display(lenses, bufnr, client_id)
local ns = namespaces[client_id]
if not lenses or not next(lenses) then
@@ -177,8 +177,8 @@ end
--- Store lenses for a specific buffer and client
---
---@param lenses table of lenses to store (`CodeLens[] | null`)
----@param bufnr number
----@param client_id number
+---@param bufnr integer
+---@param client_id integer
function M.save(lenses, bufnr, client_id)
local lenses_by_client = lens_cache_by_buf[bufnr]
if not lenses_by_client then
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 5e2bf75f1b..b27bf6e425 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -4,7 +4,7 @@
---@field range Range
---@field message string
---@field severity DiagnosticSeverity|nil
----@field code number | string
+---@field code integer | string
---@field source string
---@field tags DiagnosticTag[]
---@field relatedInformation DiagnosticRelatedInformation[]
@@ -135,7 +135,7 @@ local _client_namespaces = {}
--- Get the diagnostic namespace associated with an LSP client |vim.diagnostic|.
---
----@param client_id number The id of the LSP client
+---@param client_id integer The id of the LSP client
function M.get_namespace(client_id)
vim.validate({ client_id = { client_id, 'n' } })
if not _client_namespaces[client_id] then
@@ -212,7 +212,7 @@ end
--- this method signature is still used internally in some parts of the LSP
--- implementation so it's simply marked @private rather than @deprecated.
---
----@param client_id number
+---@param client_id integer
---@param buffer_client_map table map of buffers to active clients
---@private
function M.reset(client_id, buffer_client_map)
@@ -232,14 +232,14 @@ end
--- Marked private as this is used internally by the LSP subsystem, but
--- most users should instead prefer |vim.diagnostic.get()|.
---
----@param bufnr number|nil The buffer number
----@param line_nr number|nil The line number
+---@param bufnr integer|nil The buffer number
+---@param line_nr integer|nil The line number
---@param opts table|nil Configuration keys
--- - severity: (DiagnosticSeverity, default nil)
--- - Only return diagnostics with this severity. Overrides severity_limit
--- - severity_limit: (DiagnosticSeverity, default nil)
--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
----@param client_id|nil number the client id
+---@param client_id integer|nil the client id
---@return table Table with map of line number to list of diagnostics.
--- Structured: { [1] = {...}, [5] = {.... } }
---@private
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index d1a78572aa..51dcb7d21d 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -141,7 +141,7 @@ end
vim.tbl_add_reverse_lookup(log.levels)
--- Sets the current log level.
----@param level (string|number) One of `vim.lsp.log.levels`
+---@param level (string|integer) One of `vim.lsp.log.levels`
function log.set_level(level)
if type(level) == 'string' then
current_log_level =
@@ -167,7 +167,7 @@ function log.set_format_func(handle)
end
--- Checks whether the level is sufficient for logging.
----@param level number log level
+---@param level integer log level
---@returns (bool) true if would log, false if not
function log.should_log(level)
return level >= current_log_level
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index aa833deb99..30b61d01d6 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -186,7 +186,7 @@ end
--- Creates an RPC response object/table.
---
----@param code number RPC error code defined in `vim.lsp.protocol.ErrorCodes`
+---@param code integer RPC error code defined in `vim.lsp.protocol.ErrorCodes`
---@param message string|nil arbitrary message to send to server
---@param data any|nil arbitrary data to send to server
local function rpc_response_error(code, message, data)
@@ -224,8 +224,8 @@ end
---@private
--- Default dispatcher for when a client exits.
---
----@param code (number): Exit code
----@param signal (number): Number describing the signal used to terminate (if
+---@param code (integer): Exit code
+---@param signal (integer): Number describing the signal used to terminate (if
---any)
function default_dispatchers.on_exit(code, signal)
local _ = log.info() and log.info('client_exit', { code = code, signal = signal })
@@ -233,7 +233,7 @@ end
---@private
--- Default dispatcher for client errors.
---
----@param code (number): Error code
+---@param code (integer): Error code
---@param err (any): Details about the error
---any)
function default_dispatchers.on_error(code, err)
@@ -270,7 +270,7 @@ local function create_read_loop(handle_body, on_no_chunk, on_error)
end
---@class RpcClient
----@field message_index number
+---@field message_index integer
---@field message_callbacks table
---@field notify_reply_callbacks table
---@field transport table
@@ -588,7 +588,7 @@ end
--- and port
---
---@param host string
----@param port number
+---@param port integer
---@return function
local function connect(host, port)
return function(dispatchers)
@@ -692,8 +692,8 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
---@private
--- Callback for |vim.loop.spawn()| Closes all streams and runs the `on_exit` dispatcher.
- ---@param code (number) Exit code
- ---@param signal (number) Signal that was used to terminate (if any)
+ ---@param code (integer) Exit code
+ ---@param signal (integer) Signal that was used to terminate (if any)
local function onexit(code, signal)
stdin:close()
stdout:close()
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index 7983d066b8..9eaccd539f 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -4,36 +4,36 @@ local util = require('vim.lsp.util')
local bit = require('bit')
--- @class STTokenRange
---- @field line number line number 0-based
---- @field start_col number start column 0-based
---- @field end_col number end column 0-based
+--- @field line integer line number 0-based
+--- @field start_col integer start column 0-based
+--- @field end_col integer end column 0-based
--- @field type string token type as string
--- @field modifiers table token modifiers as a set. E.g., { static = true, readonly = true }
--- @field marked boolean whether this token has had extmarks applied
---
--- @class STCurrentResult
---- @field version number document version associated with this result
+--- @field version integer document version associated with this result
--- @field result_id string resultId from the server; used with delta requests
--- @field highlights STTokenRange[] cache of highlight ranges for this document version
---- @field tokens number[] raw token array as received by the server. used for calculating delta responses
+--- @field tokens integer[] raw token array as received by the server. used for calculating delta responses
--- @field namespace_cleared boolean whether the namespace was cleared for this result yet
---
--- @class STActiveRequest
---- @field request_id number the LSP request ID of the most recent request sent to the server
---- @field version number the document version associated with the most recent request
+--- @field request_id integer the LSP request ID of the most recent request sent to the server
+--- @field version integer the document version associated with the most recent request
---
--- @class STClientState
---- @field namespace number
+--- @field namespace integer
--- @field active_request STActiveRequest
--- @field current_result STCurrentResult
---@class STHighlighter
----@field active table<number, STHighlighter>
----@field bufnr number
----@field augroup number augroup for buffer events
----@field debounce number milliseconds to debounce requests for new tokens
+---@field active table<integer, STHighlighter>
+---@field bufnr integer
+---@field augroup integer augroup for buffer events
+---@field debounce integer milliseconds to debounce requests for new tokens
---@field timer table uv_timer for debouncing requests for new tokens
----@field client_state table<number, STClientState>
+---@field client_state table<integer, STClientState>
local STHighlighter = { active = {} }
--- Do a binary search of the tokens in the half-open range [lo, hi).
@@ -141,7 +141,7 @@ end
--- Construct a new STHighlighter for the buffer
---
---@private
----@param bufnr number
+---@param bufnr integer
function STHighlighter.new(bufnr)
local self = setmetatable({}, { __index = STHighlighter })
@@ -470,7 +470,7 @@ end
--- in case the server supports delta requests.
---
---@private
----@param client_id number
+---@param client_id integer
function STHighlighter:mark_dirty(client_id)
local state = self.client_state[client_id]
assert(state)
@@ -529,10 +529,10 @@ local M = {}
--- client.server_capabilities.semanticTokensProvider = nil
--- </pre>
---
----@param bufnr number
----@param client_id number
+---@param bufnr integer
+---@param client_id integer
---@param opts (nil|table) Optional keyword arguments
---- - debounce (number, default: 200): Debounce token requests
+--- - debounce (integer, default: 200): Debounce token requests
--- to the server by the given number in milliseconds
function M.start(bufnr, client_id, opts)
vim.validate({
@@ -585,8 +585,8 @@ end
--- of `start()`, so you should only need this function to manually disengage the semantic
--- token engine without fully detaching the LSP client from the buffer.
---
----@param bufnr number
----@param client_id number
+---@param bufnr integer
+---@param client_id integer
function M.stop(bufnr, client_id)
vim.validate({
bufnr = { bufnr, 'n', false },
@@ -608,15 +608,15 @@ end
--- Return the semantic token(s) at the given position.
--- If called without arguments, returns the token under the cursor.
---
----@param bufnr number|nil Buffer number (0 for current buffer, default)
----@param row number|nil Position row (default cursor position)
----@param col number|nil Position column (default cursor position)
+---@param bufnr integer|nil Buffer number (0 for current buffer, default)
+---@param row integer|nil Position row (default cursor position)
+---@param col integer|nil Position column (default cursor position)
---
---@return table|nil (table|nil) List of tokens at position. Each token has
--- the following fields:
---- - line (number) line number, 0-based
---- - start_col (number) start column, 0-based
---- - end_col (number) end column, 0-based
+--- - line (integer) line number, 0-based
+--- - start_col (integer) start column, 0-based
+--- - end_col (integer) end column, 0-based
--- - type (string) token type as string, e.g. "variable"
--- - modifiers (table) token modifiers as a set. E.g., { static = true, readonly = true }
function M.get_at_pos(bufnr, row, col)
@@ -661,7 +661,7 @@ end
--- Only has an effect if the buffer is currently active for semantic token
--- highlighting (|vim.lsp.semantic_tokens.start()| has been called for it)
---
----@param bufnr (number|nil) filter by buffer. All buffers if nil, current
+---@param bufnr (integer|nil) filter by buffer. All buffers if nil, current
--- buffer if 0
function M.force_refresh(bufnr)
vim.validate({
@@ -689,11 +689,11 @@ end
--- use inside |LspTokenUpdate| callbacks.
---@param token (table) a semantic token, found as `args.data.token` in
--- |LspTokenUpdate|.
----@param bufnr (number) the buffer to highlight
----@param client_id (number) The ID of the |vim.lsp.client|
+---@param bufnr (integer) the buffer to highlight
+---@param client_id (integer) The ID of the |vim.lsp.client|
---@param hl_group (string) Highlight group name
---@param opts (table|nil) Optional parameters.
---- - priority: (number|nil) Priority for the applied extmark. Defaults
+--- - priority: (integer|nil) Priority for the applied extmark. Defaults
--- to `vim.highlight.priorities.semantic_tokens + 3`
function M.highlight_token(token, bufnr, client_id, hl_group, opts)
local highlighter = STHighlighter.active[bufnr]
diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua
index 826352f036..fb5b0b3194 100644
--- a/runtime/lua/vim/lsp/sync.lua
+++ b/runtime/lua/vim/lsp/sync.lua
@@ -388,9 +388,9 @@ end
--- Returns the range table for the difference between prev and curr lines
---@param prev_lines table list of lines
---@param curr_lines table list of lines
----@param firstline number line to begin search for first difference
----@param lastline number line to begin search in old_lines for last difference
----@param new_lastline number line to begin search in new_lines for last difference
+---@param firstline integer line to begin search for first difference
+---@param lastline integer line to begin search in old_lines for last difference
+---@param new_lastline integer line to begin search in new_lines for last difference
---@param offset_encoding string encoding requested by language server
---@returns table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentContentChangeEvent
function M.compute_diff(
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 554e26022c..c9613dc7a7 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -121,9 +121,9 @@ end
--- Convert byte index to `encoding` index.
--- Convenience wrapper around vim.str_utfindex
---@param line string line to be indexed
----@param index number|nil byte index (utf-8), or `nil` for length
+---@param index integer|nil byte index (utf-8), or `nil` for length
---@param encoding string utf-8|utf-16|utf-32|nil defaults to utf-16
----@return number `encoding` index of `index` in `line`
+---@return integer `encoding` index of `index` in `line`
function M._str_utfindex_enc(line, index, encoding)
if not encoding then
encoding = 'utf-16'
@@ -149,9 +149,9 @@ end
--- Convenience wrapper around vim.str_byteindex
---Alternative to vim.str_byteindex that takes an encoding.
---@param line string line to be indexed
----@param index number UTF index
+---@param index integer UTF index
---@param encoding string utf-8|utf-16|utf-32|nil defaults to utf-16
----@return number byte (utf-8) index of `encoding` index `index` in `line`
+---@return integer byte (utf-8) index of `encoding` index `index` in `line`
function M._str_byteindex_enc(line, index, encoding)
if not encoding then
encoding = 'utf-16'
@@ -239,9 +239,9 @@ end
--- Works on unloaded buffers by reading the file using libuv to bypass buf reading events.
--- Falls back to loading the buffer and nvim_buf_get_lines for buffers with non-file URI.
---
----@param bufnr number bufnr to get the lines from
----@param rows number[] zero-indexed line numbers
----@return table<number string> a table mapping rows to lines
+---@param bufnr integer bufnr to get the lines from
+---@param rows integer[] zero-indexed line numbers
+---@return table<integer, string> a table mapping rows to lines
local function get_lines(bufnr, rows)
rows = type(rows) == 'table' and rows or { rows }
@@ -321,8 +321,8 @@ end
--- Works on unloaded buffers by reading the file using libuv to bypass buf reading events.
--- Falls back to loading the buffer and nvim_buf_get_lines for buffers with non-file URI.
---
----@param bufnr number
----@param row number zero-indexed line number
+---@param bufnr integer
+---@param row integer zero-indexed line number
---@return string the line at row in filename
local function get_line(bufnr, row)
return get_lines(bufnr, { row })[row]
@@ -386,7 +386,7 @@ end
--- Applies a list of text edits to a buffer.
---@param text_edits table list of `TextEdit` objects
----@param bufnr number Buffer id
+---@param bufnr integer Buffer id
---@param offset_encoding string utf-8|utf-16|utf-32
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
function M.apply_text_edits(text_edits, bufnr, offset_encoding)
@@ -571,7 +571,7 @@ end
--- document.
---
---@param text_document_edit table: a `TextDocumentEdit` object
----@param index number: Optional index of the edit, if from a list of edits (or nil, if not from a list)
+---@param index integer: Optional index of the edit, if from a list of edits (or nil, if not from a list)
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
local text_document = text_document_edit.textDocument
@@ -1009,11 +1009,11 @@ end
--- Creates a table with sensible default options for a floating window. The
--- table can be passed to |nvim_open_win()|.
---
----@param width (number) window width (in character cells)
----@param height (number) window height (in character cells)
+---@param width (integer) window width (in character cells)
+---@param height (integer) window height (in character cells)
---@param opts (table, optional)
---- - offset_x (number) offset to add to `col`
---- - offset_y (number) offset to add to `row`
+--- - offset_x (integer) offset to add to `col`
+--- - offset_y (integer) offset to add to `row`
--- - border (string or table) override `border`
--- - focusable (string or table) override `focusable`
--- - zindex (string or table) override `zindex`, defaults to 50
@@ -1429,7 +1429,7 @@ end
---@private
--- Closes the preview window
---
----@param winnr number window id of preview window
+---@param winnr integer window id of preview window
---@param bufnrs table|nil optional list of ignored buffers
local function close_preview_window(winnr, bufnrs)
vim.schedule(function()
@@ -1448,7 +1448,7 @@ end
--- Creates autocommands to close a preview window when events happen.
---
---@param events table list of events
----@param winnr number window id of preview window
+---@param winnr integer window id of preview window
---@param bufnrs table list of buffers where the preview window will remain visible
---@see |autocmd-events|
local function close_preview_autocmd(events, winnr, bufnrs)
@@ -1556,14 +1556,14 @@ end
---@param contents table of lines to show in window
---@param syntax string of syntax to set for opened buffer
---@param opts table with optional fields (additional keys are passed on to |nvim_open_win()|)
---- - height: (number) height of floating window
---- - width: (number) width of floating window
+--- - height: (integer) height of floating window
+--- - width: (integer) width of floating window
--- - wrap: (boolean, default true) wrap long lines
---- - wrap_at: (number) character to wrap at for computing height when wrap is enabled
---- - max_width: (number) maximal width of floating window
---- - max_height: (number) maximal height of floating window
---- - pad_top: (number) number of lines to pad contents at top
---- - pad_bottom: (number) number of lines to pad contents at bottom
+--- - wrap_at: (integer) character to wrap at for computing height when wrap is enabled
+--- - max_width: (integer) maximal width of floating window
+--- - max_height: (integer) maximal height of floating window
+--- - pad_top: (integer) number of lines to pad contents at top
+--- - pad_bottom: (integer) number of lines to pad contents at bottom
--- - focus_id: (string) if a popup with this id is opened, then focus it
--- - close_events: (table) list of events that closes the floating window
--- - focusable: (boolean, default true) Make float focusable
@@ -1672,7 +1672,7 @@ do --[[ References ]]
--- Removes document highlights from a buffer.
---
- ---@param bufnr number Buffer id
+ ---@param bufnr integer Buffer id
function M.buf_clear_references(bufnr)
validate({ bufnr = { bufnr, 'n', true } })
api.nvim_buf_clear_namespace(bufnr or 0, reference_ns, 0, -1)
@@ -1680,7 +1680,7 @@ do --[[ References ]]
--- Shows a list of document highlights for a certain buffer.
---
- ---@param bufnr number Buffer id
+ ---@param bufnr integer Buffer id
---@param references table List of `DocumentHighlight` objects to highlight
---@param offset_encoding string One of "utf-8", "utf-16", "utf-32".
---@see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentContentChangeEvent
@@ -1893,7 +1893,7 @@ function M.try_trim_markdown_code_blocks(lines)
end
---@private
----@param window number|nil: window handle or 0 for current, defaults to current
+---@param window integer|nil: window handle or 0 for current, defaults to current
---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
local function make_position_param(window, offset_encoding)
window = window or 0
@@ -1913,7 +1913,7 @@ end
--- Creates a `TextDocumentPositionParams` object for the current buffer and cursor position.
---
----@param window number|nil: window handle or 0 for current, defaults to current
+---@param window integer|nil: window handle or 0 for current, defaults to current
---@param offset_encoding string|nil utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
---@returns `TextDocumentPositionParams` object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
@@ -1928,7 +1928,7 @@ function M.make_position_params(window, offset_encoding)
end
--- Utility function for getting the encoding of the first LSP client on the given buffer.
----@param bufnr (number) buffer handle or 0 for current, defaults to current
+---@param bufnr (integer) buffer handle or 0 for current, defaults to current
---@returns (string) encoding first client if there is one, nil otherwise
function M._get_offset_encoding(bufnr)
validate({
@@ -1966,7 +1966,7 @@ end
--- `textDocument/codeAction`, `textDocument/colorPresentation`,
--- `textDocument/rangeFormatting`.
---
----@param window number|nil: window handle or 0 for current, defaults to current
+---@param window integer|nil: window handle or 0 for current, defaults to current
---@param offset_encoding "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of buffer of `window`
---@returns { textDocument = { uri = `current_file_uri` }, range = { start =
---`current_position`, end = `current_position` } }
@@ -1983,11 +1983,11 @@ end
--- Using the given range in the current buffer, creates an object that
--- is similar to |vim.lsp.util.make_range_params()|.
---
----@param start_pos number[]|nil {row, col} mark-indexed position.
+---@param start_pos integer[]|nil {row, col} mark-indexed position.
--- Defaults to the start of the last visual selection.
----@param end_pos number[]|nil {row, col} mark-indexed position.
+---@param end_pos integer[]|nil {row, col} mark-indexed position.
--- Defaults to the end of the last visual selection.
----@param bufnr number|nil buffer handle or 0 for current, defaults to current
+---@param bufnr integer|nil buffer handle or 0 for current, defaults to current
---@param offset_encoding "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of `bufnr`
---@returns { textDocument = { uri = `current_file_uri` }, range = { start =
---`start_position`, end = `end_position` } }
@@ -2028,7 +2028,7 @@ end
--- Creates a `TextDocumentIdentifier` object for the current buffer.
---
----@param bufnr number|nil: Buffer handle, defaults to current
+---@param bufnr integer|nil: Buffer handle, defaults to current
---@returns `TextDocumentIdentifier`
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
function M.make_text_document_params(bufnr)
@@ -2049,8 +2049,8 @@ end
--- Returns indentation size.
---
---@see 'shiftwidth'
----@param bufnr (number|nil): Buffer handle, defaults to current
----@returns (number) indentation size
+---@param bufnr (integer|nil): Buffer handle, defaults to current
+---@returns (integer) indentation size
function M.get_effective_tabstop(bufnr)
validate({ bufnr = { bufnr, 'n', true } })
local bo = bufnr and vim.bo[bufnr] or vim.bo
@@ -2077,11 +2077,11 @@ end
--- Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
---
----@param buf number buffer number (0 for current)
+---@param buf integer buffer number (0 for current)
---@param row 0-indexed line
---@param col 0-indexed byte offset in line
---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of `buf`
----@returns (number, number) `offset_encoding` index of the character in line {row} column {col} in buffer {buf}
+---@returns (integer, integer) `offset_encoding` index of the character in line {row} column {col} in buffer {buf}
function M.character_offset(buf, row, col, offset_encoding)
local line = get_line(buf, row)
if offset_encoding == nil then