aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/diagnostic.txt44
-rw-r--r--runtime/doc/lua.txt44
-rw-r--r--runtime/doc/treesitter.txt10
-rw-r--r--runtime/lua/editorconfig.lua2
-rw-r--r--runtime/lua/vim/_editor.lua10
-rw-r--r--runtime/lua/vim/_inspector.lua14
-rw-r--r--runtime/lua/vim/diagnostic.lua46
-rw-r--r--runtime/lua/vim/filetype.lua10
-rw-r--r--runtime/lua/vim/shared.lua10
-rw-r--r--runtime/lua/vim/treesitter/playground.lua22
-rw-r--r--runtime/lua/vim/treesitter/query.lua12
-rw-r--r--runtime/lua/vim/uri.lua4
-rw-r--r--src/nvim/spell.c16
-rw-r--r--src/nvim/spell_defs.h8
-rw-r--r--src/nvim/spellfile.c19
-rw-r--r--src/nvim/spellsuggest.c12
16 files changed, 140 insertions, 143 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index c661bf02bf..cff73ad097 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -423,25 +423,25 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
severities are displayed before lower severities (e.g.
ERROR is displayed before WARN). Options:
• reverse: (boolean) Reverse sort order
- • {namespace} (number|nil) Update the options for the given namespace.
+ • {namespace} (integer|nil) Update the options for the given namespace.
When omitted, update the global diagnostic options.
disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer.
Parameters: ~
- • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
- omitted, disable diagnostics in all buffers.
- • {namespace} (number|nil) Only disable diagnostics for the given
+ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
+ When omitted, disable diagnostics in all buffers.
+ • {namespace} (integer|nil) Only disable diagnostics for the given
namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer.
Parameters: ~
- • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
- omitted, enable diagnostics in all buffers.
- • {namespace} (number|nil) Only enable diagnostics for the given
+ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
+ When omitted, enable diagnostics in all buffers.
+ • {namespace} (integer|nil) Only enable diagnostics for the given
namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()*
@@ -458,8 +458,8 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.
Parameters: ~
- • {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
- current buffer or nil for all buffers.
+ • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0
+ for current buffer or nil for all buffers.
• {opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the given
namespace.
@@ -473,7 +473,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.
Parameters: ~
- • {namespace} (number) Diagnostic namespace
+ • {namespace} (integer) Diagnostic namespace
Return: ~
(table) Namespace metadata
@@ -560,17 +560,17 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|.
Parameters: ~
- • {namespace} (number|nil) Diagnostic namespace. When omitted, hide diagnostics from all
+ • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all
namespaces.
- • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
- omitted, hide diagnostics in all buffers.
+ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
+ When omitted, hide diagnostics in all buffers.
is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()*
Check whether diagnostics are disabled in a given buffer.
Parameters: ~
- • {bufnr} (number|nil) Buffer number, or 0 for current buffer.
- • {namespace} (number|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
+ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
+ • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
disabled in {bufnr}. Otherwise, only checks if
diagnostics from {namespace} are disabled.
@@ -663,7 +663,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
from |vim.diagnostic.config()|.
Return: ~
- number|nil, number|nil: ({float_bufnr}, {win_id})
+ integer|nil, integer|nil: ({float_bufnr}, {win_id})
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
Remove all diagnostics from the given namespace.
@@ -674,17 +674,17 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
re-displayed, use |vim.diagnostic.hide()|.
Parameters: ~
- • {namespace} (number|nil) Diagnostic namespace. When omitted, remove diagnostics from all
+ • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all
namespaces.
- • {bufnr} (number|nil) Remove diagnostics for the given buffer.
+ • {bufnr} (integer|nil) Remove diagnostics for the given buffer.
When omitted, diagnostics are removed for all buffers.
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer.
Parameters: ~
- • {namespace} (number) The diagnostic namespace
- • {bufnr} (number) Buffer number
+ • {namespace} (integer) The diagnostic namespace
+ • {bufnr} (integer) Buffer number
• {diagnostics} (table) A list of diagnostic items
|diagnostic-structure|
• {opts} (table|nil) Display options to pass to
@@ -723,9 +723,9 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer.
Parameters: ~
- • {namespace} (number|nil) Diagnostic namespace. When omitted, show diagnostics from all
+ • {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all
namespaces.
- • {bufnr} (number|nil) Buffer number, or 0 for current buffer.
+ • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
When omitted, show diagnostics in all buffers.
• {diagnostics} (table|nil) The diagnostics to display. When omitted,
use the saved diagnostics for the given namespace and
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index e3e0665025..1eb5ab41e6 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1413,7 +1413,7 @@ notify({msg}, {level}, {opts}) *vim.notify()*
Parameters: ~
• {msg} (string) Content of the notification to show to the user.
- • {level} (number|nil) One of the values from |vim.log.levels|.
+ • {level} (integer|nil) One of the values from |vim.log.levels|.
• {opts} (table|nil) Optional parameters. Unused by default.
notify_once({msg}, {level}, {opts}) *vim.notify_once()*
@@ -1424,7 +1424,7 @@ notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Parameters: ~
• {msg} (string) Content of the notification to show to the user.
- • {level} (number|nil) One of the values from |vim.log.levels|.
+ • {level} (integer|nil) One of the values from |vim.log.levels|.
• {opts} (table|nil) Optional parameters. Unused by default.
Return: ~
@@ -1448,11 +1448,11 @@ on_key({fn}, {ns_id}) *vim.on_key()*
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}
- • {ns_id} number? Namespace ID. If nil or 0, generates and returns a
+ • {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
+ (integer) Namespace id associated with {fn}. Or count of all callbacks
if on_key() is called without arguments.
Note:
@@ -1507,7 +1507,7 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
points
Parameters: ~
- • {bufnr} (number) of buffer
+ • {bufnr} (integer) number of buffer
• {pos1} integer[] (line, column) tuple marking beginning of
region
• {pos2} integer[] (line, column) tuple marking end of region
@@ -1542,11 +1542,11 @@ inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()*
Can also be pretty-printed with `:Inspect!`. *:Inspect!*
Parameters: ~
- • {bufnr} (number|nil) defaults to the current buffer
- • {row} (number|nil) row to inspect, 0-based. Defaults to the row of
- the current cursor
- • {col} (number|nil) col to inspect, 0-based. Defaults to the col of
- the current cursor
+ • {bufnr} (integer|nil) defaults to the current buffer
+ • {row} (integer|nil) row to inspect, 0-based. Defaults to the row
+ of the current cursor
+ • {col} (integer|nil) col to inspect, 0-based. Defaults to the col
+ of the current cursor
• {filter} (table|nil) a table with key-value pairs to filter the items
• syntax (boolean): include syntax based highlight groups
(defaults to true)
@@ -1575,11 +1575,11 @@ show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()*
Can also be shown with `:Inspect`. *:Inspect*
Parameters: ~
- • {bufnr} (number|nil) defaults to the current buffer
- • {row} (number|nil) row to inspect, 0-based. Defaults to the row of
- the current cursor
- • {col} (number|nil) col to inspect, 0-based. Defaults to the col of
- the current cursor
+ • {bufnr} (integer|nil) defaults to the current buffer
+ • {row} (integer|nil) row to inspect, 0-based. Defaults to the row
+ of the current cursor
+ • {col} (integer|nil) col to inspect, 0-based. Defaults to the col
+ of the current cursor
• {filter} (table|nil) see |vim.inspect_pos()|
@@ -1678,8 +1678,8 @@ list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
Parameters: ~
• {dst} (table) List which will be modified and appended to
• {src} (table) List from which values will be inserted
- • {start} (number|nil) Start index on src. Defaults to 1
- • {finish} (number|nil) Final index on src. Defaults to `#src`
+ • {start} (integer|nil) Start index on src. Defaults to 1
+ • {finish} (integer|nil) Final index on src. Defaults to `#src`
Return: ~
(table) dst
@@ -1693,8 +1693,8 @@ list_slice({list}, {start}, {finish}) *vim.list_slice()*
Parameters: ~
• {list} (list) Table
- • {start} (number|nil) Start range of slice
- • {finish} (number|nil) End range of slice
+ • {start} (integer|nil) Start range of slice
+ • {finish} (integer|nil) End range of slice
Return: ~
(list) Copy of table sliced from start to finish (inclusive)
@@ -1794,7 +1794,7 @@ tbl_count({t}) *vim.tbl_count()*
• {t} (table) Table
Return: ~
- (number) Number of non-nil values in table
+ (integer) Number of non-nil values in table
See also: ~
https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
@@ -2007,7 +2007,7 @@ uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
Get a URI from a bufnr
Parameters: ~
- • {bufnr} (number)
+ • {bufnr} (integer)
Return: ~
(string) URI
@@ -2029,7 +2029,7 @@ uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
• {uri} (string)
Return: ~
- (number) bufnr
+ (integer) bufnr
uri_to_fname({uri}) *vim.uri_to_fname()*
Get a filename from a URI
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 94a93bdbbb..855fc6bdc6 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -748,7 +748,7 @@ add_directive({name}, {handler}, {force})
Parameters: ~
• {name} (string) Name of the directive, without leading #
• {handler} function(match:table<string,|TSNode|>, pattern:string,
- bufnr:number, predicate:string[], metadata:table)
+ bufnr:integer, predicate:string[], metadata:table)
• match: see |treesitter-query|
• node-level data are accessible via `match[capture_id]`
@@ -765,7 +765,7 @@ add_predicate({name}, {handler}, {force})
Parameters: ~
• {name} (string) Name of the predicate, without leading #
• {handler} function(match:table<string,|TSNode|>, pattern:string,
- bufnr:number, predicate:string[])
+ bufnr:integer, predicate:string[])
• see |vim.treesitter.add_directive()| for argument
meanings
• {force} (boolean|nil)
@@ -776,7 +776,7 @@ get_node_text({node}, {source}, {opts})
Parameters: ~
• {node} |TSNode|
- • {source} (number|string) Buffer or string from which the {node} is
+ • {source} (integer|string) Buffer or string from which the {node} is
extracted
• {opts} (table|nil) Optional parameters.
• concat: (boolean) Concatenate result in a string (default
@@ -872,8 +872,8 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
• {node} |TSNode| under which the search will occur
• {source} (integer|string) Source buffer or string to extract text
from
- • {start} (number) Starting line for the search
- • {stop} (number) Stopping line for the search (end-exclusive)
+ • {start} (integer) Starting line for the search
+ • {stop} (integer) Stopping line for the search (end-exclusive)
• {self}
Return: ~
diff --git a/runtime/lua/editorconfig.lua b/runtime/lua/editorconfig.lua
index 2079006234..5b09126788 100644
--- a/runtime/lua/editorconfig.lua
+++ b/runtime/lua/editorconfig.lua
@@ -202,7 +202,7 @@ end
--- Configure the given buffer with options from an .editorconfig file
---
----@param bufnr number Buffer number to configure
+---@param bufnr integer Buffer number to configure
---
---@private
function M.config(bufnr)
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
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index dbe8ad5763..b514ed694d 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -444,7 +444,7 @@ static void find_word(matchinf_T *mip, int mode)
// Check for word with matching case in keep-case tree.
ptr = mip->mi_word;
flen = 9999; // no case folding, always enough bytes
- byts = (uint8_t *)slang->sl_kbyts;
+ byts = slang->sl_kbyts;
idxs = slang->sl_kidxs;
if (mode == FIND_KEEPCOMPOUND) {
@@ -455,7 +455,7 @@ static void find_word(matchinf_T *mip, int mode)
// Check for case-folded in case-folded tree.
ptr = mip->mi_fword;
flen = mip->mi_fwordlen; // available case-folded bytes
- byts = (uint8_t *)slang->sl_fbyts;
+ byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
if (mode == FIND_PREFIX) {
@@ -1062,7 +1062,7 @@ static void find_prefix(matchinf_T *mip, int mode)
int wlen = 0;
slang_T *slang = mip->mi_lp->lp_slang;
- uint8_t *byts = (uint8_t *)slang->sl_pbyts;
+ uint8_t *byts = slang->sl_pbyts;
if (byts == NULL) {
return; // array is empty
}
@@ -3194,7 +3194,7 @@ void spell_dump_compl(char *pat, int ic, Direction *dir, int dumpflags_arg)
int curi[MAXWLEN];
char word[MAXWLEN];
int c;
- char *byts;
+ uint8_t *byts;
idx_T *idxs;
linenr_T lnum = 0;
int depth;
@@ -3296,7 +3296,7 @@ void spell_dump_compl(char *pat, int ic, Direction *dir, int dumpflags_arg)
// Do one more byte at this node.
n = arridx[depth] + curi[depth];
curi[depth]++;
- c = (uint8_t)byts[n];
+ c = byts[n];
if (c == 0 || depth >= MAXWLEN - 1) {
// End of word or reached maximum length, deal with the
// word.
@@ -3462,7 +3462,7 @@ static linenr_T dump_prefixes(slang_T *slang, char *word, char *pat, Direction *
has_word_up = true;
}
- char *byts = slang->sl_pbyts;
+ uint8_t *byts = slang->sl_pbyts;
idx_T *idxs = slang->sl_pidxs;
if (byts != NULL) { // array not is empty
// Loop over all prefixes, building them byte-by-byte in prefix[].
@@ -3472,7 +3472,7 @@ static linenr_T dump_prefixes(slang_T *slang, char *word, char *pat, Direction *
curi[0] = 1;
while (depth >= 0 && !got_int) {
int n = arridx[depth];
- int len = (uint8_t)byts[n];
+ int len = byts[n];
if (curi[depth] > len) {
// Done all bytes at this node, go up one level.
depth--;
@@ -3481,7 +3481,7 @@ static linenr_T dump_prefixes(slang_T *slang, char *word, char *pat, Direction *
// Do one more byte at this node.
n += curi[depth];
curi[depth]++;
- c = (uint8_t)byts[n];
+ c = byts[n];
if (c == 0) {
// End of prefix, find out how many IDs there are.
int i;
diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h
index bda43a94d1..1c163071c5 100644
--- a/src/nvim/spell_defs.h
+++ b/src/nvim/spell_defs.h
@@ -119,12 +119,12 @@ struct slang_S {
char *sl_fname; // name of .spl file
bool sl_add; // true if it's a .add file.
- char *sl_fbyts; // case-folded word bytes
+ uint8_t *sl_fbyts; // case-folded word bytes
long sl_fbyts_len; // length of sl_fbyts
idx_T *sl_fidxs; // case-folded word indexes
- char *sl_kbyts; // keep-case word bytes
+ uint8_t *sl_kbyts; // keep-case word bytes
idx_T *sl_kidxs; // keep-case word indexes
- char *sl_pbyts; // prefix tree word bytes
+ uint8_t *sl_pbyts; // prefix tree word bytes
idx_T *sl_pidxs; // prefix tree word indexes
char *sl_info; // infotext string or NULL
@@ -172,7 +172,7 @@ struct slang_S {
// Info from the .sug file. Loaded on demand.
time_t sl_sugtime; // timestamp for .sug file
- char *sl_sbyts; // soundfolded word bytes
+ uint8_t *sl_sbyts; // soundfolded word bytes
idx_T *sl_sidxs; // soundfolded word indexes
buf_T *sl_sugbuf; // buffer with word number table
bool sl_sugloaded; // true when .sug file was loaded or failed to
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index bb2ef1a458..8927b599d0 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -838,9 +838,8 @@ endOK:
// Fill in the wordcount fields for a trie.
// Returns the total number of words.
-static void tree_count_words(const char *byts_in, idx_T *idxs)
+static void tree_count_words(const uint8_t *byts, idx_T *idxs)
{
- const uint8_t *byts= (const uint8_t *)byts_in;
int depth;
idx_T arridx[MAXWLEN];
int curi[MAXWLEN];
@@ -1675,12 +1674,12 @@ static int *mb_str2wide(char *s)
/// @param prefixcnt when "prefixtree" is true: prefix count
///
/// @return zero when OK, SP_ value for an error.
-static int spell_read_tree(FILE *fd, char **bytsp, long *bytsp_len, idx_T **idxsp, bool prefixtree,
- int prefixcnt)
+static int spell_read_tree(FILE *fd, uint8_t **bytsp, long *bytsp_len, idx_T **idxsp,
+ bool prefixtree, int prefixcnt)
FUNC_ATTR_NONNULL_ARG(1, 2, 4)
{
int idx;
- char *bp;
+ uint8_t *bp;
idx_T *ip;
// The tree size was computed when writing the file, so that we can
@@ -1729,10 +1728,9 @@ static int spell_read_tree(FILE *fd, char **bytsp, long *bytsp_len, idx_T **idxs
/// @param startidx current index in "byts" and "idxs"
/// @param prefixtree true for reading PREFIXTREE
/// @param maxprefcondnr maximum for <prefcondnr>
-static idx_T read_tree_node(FILE *fd, char *byts_in, idx_T *idxs, int maxidx, idx_T startidx,
+static idx_T read_tree_node(FILE *fd, uint8_t *byts, idx_T *idxs, int maxidx, idx_T startidx,
bool prefixtree, int maxprefcondnr)
{
- uint8_t *byts = (uint8_t *)byts_in;
int len;
int n;
idx_T idx = startidx;
@@ -1819,8 +1817,7 @@ static idx_T read_tree_node(FILE *fd, char *byts_in, idx_T *idxs, int maxidx, id
idxs[startidx + i] &= ~SHARED_MASK;
} else {
idxs[startidx + i] = idx;
- idx = read_tree_node(fd, (char *)byts, idxs, maxidx, idx,
- prefixtree, maxprefcondnr);
+ idx = read_tree_node(fd, byts, idxs, maxidx, idx, prefixtree, maxprefcondnr);
if (idx < 0) {
break;
}
@@ -4955,7 +4952,7 @@ theend:
// Build the soundfold trie for language "slang".
static int sug_filltree(spellinfo_T *spin, slang_T *slang)
{
- char_u *byts;
+ uint8_t *byts;
idx_T *idxs;
int depth;
idx_T arridx[MAXWLEN];
@@ -4975,7 +4972,7 @@ static int sug_filltree(spellinfo_T *spin, slang_T *slang)
// Go through the whole case-folded tree, soundfold each word and put it
// in the trie.
- byts = (char_u *)slang->sl_fbyts;
+ byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
arridx[0] = 0;
diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c
index 2823e74c2f..2a9b5e1f4e 100644
--- a/src/nvim/spellsuggest.c
+++ b/src/nvim/spellsuggest.c
@@ -1181,7 +1181,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
if (soundfold) {
// Going through the soundfold tree.
- byts = fbyts = (uint8_t *)slang->sl_sbyts;
+ byts = fbyts = slang->sl_sbyts;
idxs = fidxs = slang->sl_sidxs;
pbyts = NULL;
pidxs = NULL;
@@ -1190,9 +1190,9 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
} else {
// When there are postponed prefixes we need to use these first. At
// the end of the prefix we continue in the case-fold tree.
- fbyts = (uint8_t *)slang->sl_fbyts;
+ fbyts = slang->sl_fbyts;
fidxs = slang->sl_fidxs;
- pbyts = (uint8_t *)slang->sl_pbyts;
+ pbyts = slang->sl_pbyts;
pidxs = slang->sl_pidxs;
if (pbyts != NULL) {
byts = pbyts;
@@ -2381,7 +2381,7 @@ static void find_keepcap_word(slang_T *slang, char *fword, char *kword)
int c;
idx_T lo, hi, m;
char *p;
- uint8_t *byts = (uint8_t *)slang->sl_kbyts; // array with bytes of the words
+ uint8_t *byts = slang->sl_kbyts; // array with bytes of the words
idx_T *idxs = slang->sl_kidxs; // array with indexes
if (byts == NULL) {
@@ -2824,7 +2824,7 @@ static void add_sound_suggest(suginfo_T *su, char *goodword, int score, langp_T
// previous wordnr.
orgnr += bytes2offset(&nrline);
- byts = (uint8_t *)slang->sl_fbyts;
+ byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
// Lookup the word "orgnr" one of the two tries.
@@ -2957,7 +2957,7 @@ static int soundfold_find(slang_T *slang, char *word)
uint8_t *ptr = (uint8_t *)word;
int wordnr = 0;
- uint8_t *byts = (uint8_t *)slang->sl_sbyts;
+ uint8_t *byts = slang->sl_sbyts;
idx_T *idxs = slang->sl_sidxs;
for (;;) {