diff options
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 10 | ||||
-rw-r--r-- | runtime/lua/vim/_inspector.lua | 14 | ||||
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 46 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 10 | ||||
-rw-r--r-- | runtime/lua/vim/shared.lua | 10 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/playground.lua | 22 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/query.lua | 12 | ||||
-rw-r--r-- | runtime/lua/vim/uri.lua | 4 |
8 files changed, 64 insertions, 64 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 3f27e61810..ab49e26dde 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -386,7 +386,7 @@ end --- Get a table of lines with start, end columns for a region marked by two points --- ----@param bufnr number of buffer +---@param bufnr integer number of buffer ---@param pos1 integer[] (line, column) tuple marking beginning of region ---@param pos2 integer[] (line, column) tuple marking end of region ---@param regtype string type of selection, see |setreg()| @@ -471,7 +471,7 @@ end --- writes to |:messages|. --- ---@param msg string Content of the notification to show to the user. ----@param level number|nil One of the values from |vim.log.levels|. +---@param level integer|nil One of the values from |vim.log.levels|. ---@param opts table|nil Optional parameters. Unused by default. function vim.notify(msg, level, opts) -- luacheck: no unused args if level == vim.log.levels.ERROR then @@ -492,7 +492,7 @@ do --- display a notification. --- ---@param msg string Content of the notification to show to the user. - ---@param level number|nil One of the values from |vim.log.levels|. + ---@param level integer|nil One of the values from |vim.log.levels|. ---@param opts table|nil Optional parameters. Unused by default. ---@return boolean true if message was displayed, else false function vim.notify_once(msg, level, opts) @@ -521,10 +521,10 @@ local on_key_cbs = {} ---@param fn function: Callback function. It should take one string argument. --- On each key press, Nvim passes the key char to fn(). |i_CTRL-V| --- If {fn} is nil, it removes the callback for the associated {ns_id} ----@param ns_id number? Namespace ID. If nil or 0, generates and returns a new +---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a new --- |nvim_create_namespace()| id. --- ----@return number Namespace id associated with {fn}. Or count of all callbacks +---@return integer Namespace id associated with {fn}. Or count of all callbacks ---if on_key() is called without arguments. --- ---@note {fn} will be removed if an error occurs while calling. diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua index bb6608421b..9e91597192 100644 --- a/runtime/lua/vim/_inspector.lua +++ b/runtime/lua/vim/_inspector.lua @@ -14,15 +14,15 @@ local defaults = { --- ---Can also be pretty-printed with `:Inspect!`. *:Inspect!* --- ----@param bufnr? number defaults to the current buffer ----@param row? number row to inspect, 0-based. Defaults to the row of the current cursor ----@param col? number col to inspect, 0-based. Defaults to the col of the current cursor +---@param bufnr? integer defaults to the current buffer +---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor +---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor ---@param filter? InspectorFilter (table|nil) a table with key-value pairs to filter the items --- - syntax (boolean): include syntax based highlight groups (defaults to true) --- - treesitter (boolean): include treesitter based highlight groups (defaults to true) --- - extmarks (boolean|"all"): include extmarks. When `all`, then extmarks without a `hl_group` will also be included (defaults to true) --- - semantic_tokens (boolean): include semantic tokens (defaults to true) ----@return {treesitter:table,syntax:table,extmarks:table,semantic_tokens:table,buffer:number,col:number,row:number} (table) a table with the following key-value pairs. Items are in "traversal order": +---@return {treesitter:table,syntax:table,extmarks:table,semantic_tokens:table,buffer:integer,col:integer,row:integer} (table) a table with the following key-value pairs. Items are in "traversal order": --- - treesitter: a list of treesitter captures --- - syntax: a list of syntax groups --- - semantic_tokens: a list of semantic tokens @@ -129,9 +129,9 @@ end --- ---Can also be shown with `:Inspect`. *:Inspect* --- ----@param bufnr? number defaults to the current buffer ----@param row? number row to inspect, 0-based. Defaults to the row of the current cursor ----@param col? number col to inspect, 0-based. Defaults to the col of the current cursor +---@param bufnr? integer defaults to the current buffer +---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor +---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor ---@param filter? InspectorFilter (table|nil) see |vim.inspect_pos()| function vim.show_pos(bufnr, row, col, filter) local items = vim.inspect_pos(bufnr, row, col, filter) diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 6fd000a029..56532d0184 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -630,7 +630,7 @@ end --- Options: --- * reverse: (boolean) Reverse sort order --- ----@param namespace number|nil Update the options for the given namespace. When omitted, update the +---@param namespace integer|nil Update the options for the given namespace. When omitted, update the --- global diagnostic options. function M.config(opts, namespace) vim.validate({ @@ -674,8 +674,8 @@ end --- Set diagnostics for the given namespace and buffer. --- ----@param namespace number The diagnostic namespace ----@param bufnr number Buffer number +---@param namespace integer The diagnostic namespace +---@param bufnr integer Buffer number ---@param diagnostics table A list of diagnostic items |diagnostic-structure| ---@param opts table|nil Display options to pass to |vim.diagnostic.show()| function M.set(namespace, bufnr, diagnostics, opts) @@ -711,7 +711,7 @@ end --- Get namespace metadata. --- ----@param namespace number Diagnostic namespace +---@param namespace integer Diagnostic namespace ---@return table Namespace metadata function M.get_namespace(namespace) vim.validate({ namespace = { namespace, 'n' } }) @@ -743,11 +743,11 @@ function M.get_namespaces() end ---@class Diagnostic ----@field buffer number ----@field lnum number 0-indexed ----@field end_lnum nil|number 0-indexed ----@field col number 0-indexed ----@field end_col nil|number 0-indexed +---@field buffer integer +---@field lnum integer 0-indexed +---@field end_lnum nil|integer 0-indexed +---@field col integer 0-indexed +---@field end_col nil|integer 0-indexed ---@field severity DiagnosticSeverity ---@field message string ---@field source nil|string @@ -756,7 +756,7 @@ end --- Get current diagnostics. --- ----@param bufnr number|nil Buffer number to get diagnostics from. Use 0 for +---@param bufnr integer|nil Buffer number to get diagnostics from. Use 0 for --- current buffer or nil for all buffers. ---@param opts table|nil A table with the following keys: --- - namespace: (number) Limit diagnostics to the given namespace. @@ -1083,9 +1083,9 @@ end --- To hide diagnostics and prevent them from re-displaying, use --- |vim.diagnostic.disable()|. --- ----@param namespace number|nil Diagnostic namespace. When omitted, hide +---@param namespace integer|nil Diagnostic namespace. When omitted, hide --- diagnostics from all namespaces. ----@param bufnr number|nil Buffer number, or 0 for current buffer. When +---@param bufnr integer|nil Buffer number, or 0 for current buffer. When --- omitted, hide diagnostics in all buffers. function M.hide(namespace, bufnr) vim.validate({ @@ -1108,8 +1108,8 @@ end --- Check whether diagnostics are disabled in a given buffer. --- ----@param bufnr number|nil Buffer number, or 0 for current buffer. ----@param namespace number|nil Diagnostic namespace. When omitted, checks if +---@param bufnr integer|nil Buffer number, or 0 for current buffer. +---@param namespace integer|nil Diagnostic namespace. When omitted, checks if --- all diagnostics are disabled in {bufnr}. --- Otherwise, only checks if diagnostics from --- {namespace} are disabled. @@ -1129,9 +1129,9 @@ end --- Display diagnostics for the given namespace and buffer. --- ----@param namespace number|nil Diagnostic namespace. When omitted, show +---@param namespace integer|nil Diagnostic namespace. When omitted, show --- diagnostics from all namespaces. ----@param bufnr number|nil Buffer number, or 0 for current buffer. When omitted, show +---@param bufnr integer|nil Buffer number, or 0 for current buffer. When omitted, show --- diagnostics in all buffers. ---@param diagnostics table|nil The diagnostics to display. When omitted, use the --- saved diagnostics for the given namespace and @@ -1256,7 +1256,7 @@ end --- Overrides the setting from |vim.diagnostic.config()|. --- - suffix: Same as {prefix}, but appends the text to the diagnostic instead of --- prepending it. Overrides the setting from |vim.diagnostic.config()|. ----@return number|nil, number|nil: ({float_bufnr}, {win_id}) +---@return integer|nil, integer|nil: ({float_bufnr}, {win_id}) function M.open_float(opts, ...) -- Support old (bufnr, opts) signature local bufnr @@ -1463,9 +1463,9 @@ end --- simply remove diagnostic decorations in a way that they can be --- re-displayed, use |vim.diagnostic.hide()|. --- ----@param namespace number|nil Diagnostic namespace. When omitted, remove +---@param namespace integer|nil Diagnostic namespace. When omitted, remove --- diagnostics from all namespaces. ----@param bufnr number|nil Remove diagnostics for the given buffer. When omitted, +---@param bufnr integer|nil Remove diagnostics for the given buffer. When omitted, --- diagnostics are removed for all buffers. function M.reset(namespace, bufnr) vim.validate({ @@ -1518,9 +1518,9 @@ end --- Disable diagnostics in the given buffer. --- ----@param bufnr number|nil Buffer number, or 0 for current buffer. When +---@param bufnr integer|nil Buffer number, or 0 for current buffer. When --- omitted, disable diagnostics in all buffers. ----@param namespace number|nil Only disable diagnostics for the given namespace. +---@param namespace integer|nil Only disable diagnostics for the given namespace. function M.disable(bufnr, namespace) vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } }) if bufnr == nil then @@ -1555,9 +1555,9 @@ end --- Enable diagnostics in the given buffer. --- ----@param bufnr number|nil Buffer number, or 0 for current buffer. When +---@param bufnr integer|nil Buffer number, or 0 for current buffer. When --- omitted, enable diagnostics in all buffers. ----@param namespace number|nil Only enable diagnostics for the given namespace. +---@param namespace integer|nil Only enable diagnostics for the given namespace. function M.enable(bufnr, namespace) vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } }) if bufnr == nil then diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 8911eafc71..65579d3543 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -28,9 +28,9 @@ end --- If only start_lnum is specified, return a single line as a string. --- If both start_lnum and end_lnum are omitted, return all lines from the buffer. --- ----@param bufnr number|nil The buffer to get the lines from ----@param start_lnum number|nil The line number of the first line (inclusive, 1-based) ----@param end_lnum number|nil The line number of the last line (inclusive, 1-based) +---@param bufnr integer|nil The buffer to get the lines from +---@param start_lnum integer|nil The line number of the first line (inclusive, 1-based) +---@param end_lnum integer|nil The line number of the last line (inclusive, 1-based) ---@return table<string>|string Array of lines, or string when end_lnum is omitted function M.getlines(bufnr, start_lnum, end_lnum) if end_lnum then @@ -67,8 +67,8 @@ end ---@private --- Get the next non-whitespace line in the buffer. --- ----@param bufnr number The buffer to get the line from ----@param start_lnum number The line number of the first line to start from (inclusive, 1-based) +---@param bufnr integer The buffer to get the line from +---@param start_lnum integer The line number of the first line to start from (inclusive, 1-based) ---@return string|nil The first non-blank line if found or `nil` otherwise function M.nextnonblank(bufnr, start_lnum) for _, line in ipairs(M.getlines(bufnr, start_lnum, -1)) do diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index cc48e3f193..1c8defc93a 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -418,8 +418,8 @@ end ---@generic T: table ---@param dst T List which will be modified and appended to ---@param src table List from which values will be inserted ----@param start (number|nil) Start index on src. Defaults to 1 ----@param finish (number|nil) Final index on src. Defaults to `#src` +---@param start (integer|nil) Start index on src. Defaults to 1 +---@param finish (integer|nil) Final index on src. Defaults to `#src` ---@return T dst function vim.list_extend(dst, src, start, finish) vim.validate({ @@ -529,7 +529,7 @@ end --- ---@see https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua ---@param t table Table ----@return number Number of non-nil values in table +---@return integer Number of non-nil values in table function vim.tbl_count(t) vim.validate({ t = { t, 't' } }) @@ -544,8 +544,8 @@ end --- ---@generic T ---@param list T[] (list) Table ----@param start number|nil Start range of slice ----@param finish number|nil End range of slice +---@param start integer|nil Start range of slice +---@param finish integer|nil End range of slice ---@return T[] (list) Copy of table sliced from start to finish (inclusive) function vim.list_slice(list, start, finish) local new_list = {} diff --git a/runtime/lua/vim/treesitter/playground.lua b/runtime/lua/vim/treesitter/playground.lua index 992433961f..7f181c23fd 100644 --- a/runtime/lua/vim/treesitter/playground.lua +++ b/runtime/lua/vim/treesitter/playground.lua @@ -1,7 +1,7 @@ local api = vim.api ---@class TSPlayground ----@field ns number API namespace +---@field ns integer API namespace ---@field opts table Options table with the following keys: --- - anon (boolean): If true, display anonymous nodes --- - lang (boolean): If true, display the language alongside each node @@ -10,14 +10,14 @@ local api = vim.api local TSPlayground = {} --- ---@class Node ----@field id number Node id +---@field id integer Node id ---@field text string Node text ---@field named boolean True if this is a named (non-anonymous) node ----@field depth number Depth of the node within the tree ----@field lnum number Beginning line number of this node in the source buffer ----@field col number Beginning column number of this node in the source buffer ----@field end_lnum number Final line number of this node in the source buffer ----@field end_col number Final column number of this node in the source buffer +---@field depth integer Depth of the node within the tree +---@field lnum integer Beginning line number of this node in the source buffer +---@field col integer Beginning column number of this node in the source buffer +---@field end_lnum integer Final line number of this node in the source buffer +---@field end_col integer Final column number of this node in the source buffer ---@field lang string Source language of this node ---@field root TSNode @@ -34,7 +34,7 @@ local TSPlayground = {} --- table maps nodes in the primary tree to root nodes of injected trees. --- ---@param node TSNode Starting node to begin traversal |tsnode| ----@param depth number Current recursion depth +---@param depth integer Current recursion depth ---@param lang string Language of the tree currently being traversed ---@param injections table<integer,Node> Mapping of node ids to root nodes of injected language trees (see --- explanation above) @@ -153,7 +153,7 @@ end --- Write the contents of this Playground into {bufnr}. --- ----@param bufnr number Buffer number to write into. +---@param bufnr integer Buffer number to write into. ---@private function TSPlayground:draw(bufnr) vim.bo[bufnr].modifiable = true @@ -194,7 +194,7 @@ end --- --- The node number is dependent on whether or not anonymous nodes are displayed. --- ----@param i number Node number to get +---@param i integer Node number to get ---@return Node ---@private function TSPlayground:get(i) @@ -206,7 +206,7 @@ end --- ---@return (fun(): integer, Node) Iterator over all nodes in this Playground ---@return table ----@return number +---@return integer ---@private function TSPlayground:iter() return ipairs(self.opts.anon and self.nodes or self.named) diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 4e9871b59d..22f706585e 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -56,7 +56,7 @@ local function add_included_lang(base_langs, lang, ilang) end ---@private ----@param buf (number) +---@param buf (integer) ---@param range (table) ---@param concat (boolean) ---@returns (string[]|string|nil) @@ -269,7 +269,7 @@ end --- Gets the text corresponding to a given node --- ---@param node TSNode ----@param source (number|string) Buffer or string from which the {node} is extracted +---@param source (integer|string) Buffer or string from which the {node} is extracted ---@param opts (table|nil) Optional parameters. --- - concat: (boolean) Concatenate result in a string (default true) --- - metadata (table) Metadata of a specific capture. This would be @@ -484,7 +484,7 @@ local directive_handlers = { --- Adds a new predicate to be used in queries --- ---@param name string Name of the predicate, without leading # ----@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[]) +---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[]) --- - see |vim.treesitter.add_directive()| for argument meanings ---@param force boolean|nil function M.add_predicate(name, handler, force) @@ -503,7 +503,7 @@ end --- metadata table `metadata[capture_id].key = value` --- ---@param name string Name of the directive, without leading # ----@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[], metadata:table) +---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[], metadata:table) --- - match: see |treesitter-query| --- - node-level data are accessible via `match[capture_id]` --- - pattern: see |treesitter-query| @@ -644,8 +644,8 @@ end --- ---@param node TSNode under which the search will occur ---@param source (integer|string) Source buffer or string to extract text from ----@param start number Starting line for the search ----@param stop number Stopping line for the search (end-exclusive) +---@param start integer Starting line for the search +---@param stop integer Stopping line for the search (end-exclusive) --- ---@return (fun(): integer, TSNode, TSMetadata): capture id, capture node, metadata function Query:iter_captures(node, source, start, stop) diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua index d6b0b7410e..38759fcdc0 100644 --- a/runtime/lua/vim/uri.lua +++ b/runtime/lua/vim/uri.lua @@ -80,7 +80,7 @@ local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*' local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):[a-zA-Z]:.*' --- Get a URI from a bufnr ----@param bufnr number +---@param bufnr integer ---@return string URI local function uri_from_bufnr(bufnr) local fname = vim.api.nvim_buf_get_name(bufnr) @@ -123,7 +123,7 @@ end --- Creates a new unloaded buffer if no buffer for the uri already exists. -- ---@param uri string ----@return number bufnr +---@return integer bufnr local function uri_to_bufnr(uri) return vim.fn.bufadd(uri_to_fname(uri)) end |