mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
refactor(lua): use tuple syntax everywhere #29111
This commit is contained in:
parent
61025c9e7a
commit
8cbb1f20e5
@ -393,11 +393,11 @@ Lua module: vim.diagnostic *diagnostic-api*
|
||||
by {count} diagnostics, while a negative integer moves
|
||||
backward by {count} diagnostics. Mutually exclusive
|
||||
with {diagnostic}.
|
||||
• {pos}? (`{[1]:integer,[2]:integer}`) Cursor position as a
|
||||
`(row, col)` tuple. See |nvim_win_get_cursor()|. Used
|
||||
to find the nearest diagnostic when {count} is used.
|
||||
Only used when {count} is non-nil. Default is the
|
||||
current cursor position.
|
||||
• {pos}? (`[integer,integer]`) Cursor position as a `(row, col)`
|
||||
tuple. See |nvim_win_get_cursor()|. Used to find the
|
||||
nearest diagnostic when {count} is used. Only used when
|
||||
{count} is non-nil. Default is the current cursor
|
||||
position.
|
||||
• {wrap}? (`boolean`, default: `true`) Whether to loop around
|
||||
file or not. Similar to 'wrapscan'.
|
||||
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|
||||
@ -467,18 +467,18 @@ Lua module: vim.diagnostic *diagnostic-api*
|
||||
current cursor position (`cursor`). Shorthand
|
||||
versions are also accepted (`c` for `cursor`, `l`
|
||||
for `line`, `b` for `buffer`).
|
||||
• {pos}? (`integer|{[1]:integer,[2]:integer}`) If {scope} is
|
||||
"line" or "cursor", use this position rather than
|
||||
the cursor position. If a number, interpreted as a
|
||||
line number; otherwise, a (row, col) tuple.
|
||||
• {pos}? (`integer|[integer,integer]`) If {scope} is "line"
|
||||
or "cursor", use this position rather than the
|
||||
cursor position. If a number, interpreted as a line
|
||||
number; otherwise, a (row, col) tuple.
|
||||
• {severity_sort}? (`boolean|{reverse?:boolean}`, default: `false`)
|
||||
Sort diagnostics by severity. Overrides the setting
|
||||
from |vim.diagnostic.config()|.
|
||||
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|
||||
|diagnostic-severity|. Overrides the setting from
|
||||
|vim.diagnostic.config()|.
|
||||
• {header}? (`string|{[1]:string,[2]:any}`) String to use as the
|
||||
header for the floating window. If a table, it is
|
||||
• {header}? (`string|[string,any]`) String to use as the header
|
||||
for the floating window. If a table, it is
|
||||
interpreted as a `[text, hl_group]` tuple. Overrides
|
||||
the setting from |vim.diagnostic.config()|.
|
||||
• {source}? (`boolean|'if_many'`) Include the diagnostic source
|
||||
@ -591,8 +591,7 @@ Lua module: vim.diagnostic *diagnostic-api*
|
||||
<
|
||||
• {hl_mode}? (`'replace'|'combine'|'blend'`) See
|
||||
|nvim_buf_set_extmark()|.
|
||||
• {virt_text}? (`{[1]:string,[2]:any}[]`) See
|
||||
|nvim_buf_set_extmark()|.
|
||||
• {virt_text}? (`[string,any][]`) See |nvim_buf_set_extmark()|.
|
||||
• {virt_text_pos}? (`'eol'|'overlay'|'right_align'|'inline'`) See
|
||||
|nvim_buf_set_extmark()|.
|
||||
• {virt_text_win_col}? (`integer`) See |nvim_buf_set_extmark()|.
|
||||
|
@ -834,8 +834,8 @@ vim.spell.check({str}) *vim.spell.check()*
|
||||
• {str} (`string`)
|
||||
|
||||
Return: ~
|
||||
(`{[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]`)
|
||||
List of tuples with three items:
|
||||
(`[string, 'bad'|'rare'|'local'|'caps', integer][]`) List of tuples
|
||||
with three items:
|
||||
• The badly spelled word.
|
||||
• The type of the spelling error: "bad" spelling mistake "rare" rare
|
||||
word "local" word only valid in another region "caps" word should
|
||||
|
@ -764,9 +764,9 @@ get_node({opts}) *vim.treesitter.get_node()*
|
||||
• {opts} (`table?`) Optional keyword arguments:
|
||||
• {bufnr} (`integer?`) Buffer number (nil or 0 for current
|
||||
buffer)
|
||||
• {pos} (`{ [1]: integer, [2]: integer }?`) 0-indexed (row,
|
||||
col) tuple. Defaults to cursor position in the current
|
||||
window. Required if {bufnr} is not the current buffer
|
||||
• {pos} (`[integer, integer]?`) 0-indexed (row, col) tuple.
|
||||
Defaults to cursor position in the current window. Required
|
||||
if {bufnr} is not the current buffer
|
||||
• {lang} (`string?`) Parser language. (default: from buffer
|
||||
filetype)
|
||||
• {ignore_injections} (`boolean?`) Ignore injected languages
|
||||
|
@ -46,7 +46,7 @@
|
||||
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
|
||||
|
||||
--- @class (private) vim.tohtml.line
|
||||
--- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]}
|
||||
--- @field virt_lines {[integer]:[string,integer][]}
|
||||
--- @field pre_text string[][]
|
||||
--- @field hide? boolean
|
||||
--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive))
|
||||
@ -481,7 +481,7 @@ local function styletable_treesitter(state)
|
||||
end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
|
||||
--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
|
||||
--- @param namespaces table<integer,string>
|
||||
local function _styletable_extmarks_highlight(state, extmark, namespaces)
|
||||
if not extmark[4].hl_group then
|
||||
@ -503,7 +503,7 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
|
||||
end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
|
||||
--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
|
||||
--- @param namespaces table<integer,string>
|
||||
local function _styletable_extmarks_virt_text(state, extmark, namespaces)
|
||||
if not extmark[4].virt_text then
|
||||
@ -559,7 +559,7 @@ local function _styletable_extmarks_virt_text(state, extmark, namespaces)
|
||||
end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
|
||||
--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
|
||||
local function _styletable_extmarks_virt_lines(state, extmark)
|
||||
---TODO(altermo) if the fold start is equal to virt_line start then the fold hides the virt_line
|
||||
if not extmark[4].virt_lines then
|
||||
@ -580,7 +580,7 @@ local function _styletable_extmarks_virt_lines(state, extmark)
|
||||
end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
|
||||
--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
|
||||
local function _styletable_extmarks_conceal(state, extmark)
|
||||
if not extmark[4].conceal or state.opt.conceallevel == 0 then
|
||||
return
|
||||
@ -648,7 +648,7 @@ local function styletable_conceal(state)
|
||||
local bufnr = state.bufnr
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
for row = 1, state.buflen do
|
||||
--- @type table<integer,{[1]:integer,[2]:integer,[3]:string}>
|
||||
--- @type table<integer,[integer,integer,string]>
|
||||
local conceals = {}
|
||||
local line_len_exclusive = #vim.fn.getline(row) + 1
|
||||
for col = 1, line_len_exclusive do
|
||||
|
@ -26,13 +26,13 @@ error('Cannot require a meta file')
|
||||
--- @field url? boolean
|
||||
--- @field hl_mode? string
|
||||
---
|
||||
--- @field virt_text? {[1]: string, [2]: string}[]
|
||||
--- @field virt_text? [string, string][]
|
||||
--- @field virt_text_hide? boolean
|
||||
--- @field virt_text_repeat_linebreak? boolean
|
||||
--- @field virt_text_win_col? integer
|
||||
--- @field virt_text_pos? string
|
||||
---
|
||||
--- @field virt_lines? {[1]: string, [2]: string}[][]
|
||||
--- @field virt_lines? [string, string][][]
|
||||
--- @field virt_lines_above? boolean
|
||||
--- @field virt_lines_leftcol? boolean
|
||||
---
|
||||
|
@ -25,7 +25,7 @@
|
||||
--- @field variables table<string,any>
|
||||
--- @field windows integer[]
|
||||
|
||||
--- @alias vim.fn.getjumplist.ret {[1]: vim.fn.getjumplist.ret.item[], [2]: integer}
|
||||
--- @alias vim.fn.getjumplist.ret [vim.fn.getjumplist.ret.item[], integer]
|
||||
|
||||
--- @class vim.fn.getjumplist.ret.item
|
||||
--- @field bufnr integer
|
||||
|
@ -20,7 +20,7 @@
|
||||
--- ```
|
||||
---
|
||||
--- @param str string
|
||||
--- @return {[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]
|
||||
--- @return [string, 'bad'|'rare'|'local'|'caps', integer][]
|
||||
--- List of tuples with three items:
|
||||
--- - The badly spelled word.
|
||||
--- - The type of the spelling error:
|
||||
|
2
runtime/lua/vim/_meta/vimfn.lua
generated
2
runtime/lua/vim/_meta/vimfn.lua
generated
@ -9796,7 +9796,7 @@ function vim.fn.synIDtrans(synID) end
|
||||
---
|
||||
--- @param lnum integer
|
||||
--- @param col integer
|
||||
--- @return {[1]: integer, [2]: string, [3]: integer}
|
||||
--- @return [integer, string, integer]
|
||||
function vim.fn.synconcealed(lnum, col) end
|
||||
|
||||
--- Return a |List|, which is the stack of syntax items at the
|
||||
|
@ -1,7 +1,7 @@
|
||||
local M = {}
|
||||
local health = vim.health
|
||||
|
||||
local deprecated = {} ---@type {[1]: string, [2]: table, [3]: string}[]
|
||||
local deprecated = {} ---@type [string, table, string][]
|
||||
|
||||
function M.check()
|
||||
if next(deprecated) == nil then
|
||||
|
@ -108,7 +108,7 @@ local M = {}
|
||||
--- If {scope} is "line" or "cursor", use this position rather than the cursor
|
||||
--- position. If a number, interpreted as a line number; otherwise, a
|
||||
--- (row, col) tuple.
|
||||
--- @field pos? integer|{[1]:integer,[2]:integer}
|
||||
--- @field pos? integer|[integer,integer]
|
||||
---
|
||||
--- Sort diagnostics by severity.
|
||||
--- Overrides the setting from |vim.diagnostic.config()|.
|
||||
@ -122,7 +122,7 @@ local M = {}
|
||||
--- String to use as the header for the floating window. If a table, it is
|
||||
--- interpreted as a `[text, hl_group]` tuple.
|
||||
--- Overrides the setting from |vim.diagnostic.config()|.
|
||||
--- @field header? string|{[1]:string,[2]:any}
|
||||
--- @field header? string|[string,any]
|
||||
---
|
||||
--- Include the diagnostic source in the message.
|
||||
--- Use "if_many" to only show sources if there is more than one source of
|
||||
@ -203,7 +203,7 @@ local M = {}
|
||||
--- @field hl_mode? 'replace'|'combine'|'blend'
|
||||
---
|
||||
--- See |nvim_buf_set_extmark()|.
|
||||
--- @field virt_text? {[1]:string,[2]:any}[]
|
||||
--- @field virt_text? [string,any][]
|
||||
---
|
||||
--- See |nvim_buf_set_extmark()|.
|
||||
--- @field virt_text_pos? 'eol'|'overlay'|'right_align'|'inline'
|
||||
@ -1252,7 +1252,7 @@ end
|
||||
--- Cursor position as a `(row, col)` tuple. See |nvim_win_get_cursor()|. Used
|
||||
--- to find the nearest diagnostic when {count} is used. Only used when {count}
|
||||
--- is non-nil. Default is the current cursor position.
|
||||
--- @field pos? {[1]:integer,[2]:integer}
|
||||
--- @field pos? [integer,integer]
|
||||
---
|
||||
--- Whether to loop around file or not. Similar to 'wrapscan'.
|
||||
--- (default: `true`)
|
||||
|
@ -4,7 +4,7 @@ local fn = vim.fn
|
||||
local M = {}
|
||||
|
||||
--- @alias vim.filetype.mapfn fun(path:string,bufnr:integer, ...):string?, fun(b:integer)?
|
||||
--- @alias vim.filetype.maptbl {[1]:string|vim.filetype.mapfn, [2]:{priority:integer}}
|
||||
--- @alias vim.filetype.maptbl [string|vim.filetype.mapfn, {priority:integer}]
|
||||
--- @alias vim.filetype.mapping.value string|vim.filetype.mapfn|vim.filetype.maptbl
|
||||
--- @alias vim.filetype.mapping table<string,vim.filetype.mapping.value>
|
||||
|
||||
|
@ -30,7 +30,7 @@ local buf_handles = {}
|
||||
--- @nodoc
|
||||
--- @class vim.lsp.completion.Context
|
||||
local Context = {
|
||||
cursor = nil, --- @type { [1]: integer, [2]: integer }?
|
||||
cursor = nil, --- @type [integer, integer]?
|
||||
last_request_time = nil, --- @type integer?
|
||||
pending_requests = {}, --- @type function[]
|
||||
isIncomplete = false,
|
||||
|
@ -348,7 +348,7 @@ api.nvim_set_decoration_provider(namespace, {
|
||||
text = text .. part.value
|
||||
end
|
||||
end
|
||||
local vt = {} --- @type {[1]: string, [2]: string?}[]
|
||||
local vt = {} --- @type [string, string?][]
|
||||
if hint.paddingLeft then
|
||||
vt[#vt + 1] = { ' ' }
|
||||
end
|
||||
|
@ -353,7 +353,7 @@ end
|
||||
--- their respective paths. If either of those is invalid, return two empty
|
||||
--- strings, effectively ignoring pyenv.
|
||||
---
|
||||
--- @return {[1]: string, [2]: string}
|
||||
--- @return [string, string]
|
||||
local function check_for_pyenv()
|
||||
local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
|
||||
|
||||
|
@ -789,7 +789,7 @@ do
|
||||
}
|
||||
|
||||
--- @nodoc
|
||||
--- @class vim.validate.Spec {[1]: any, [2]: string|string[], [3]: boolean }
|
||||
--- @class vim.validate.Spec [any, string|string[], boolean]
|
||||
--- @field [1] any Argument value
|
||||
--- @field [2] string|string[]|fun(v:any):boolean, string? Type name, or callable
|
||||
--- @field [3]? boolean
|
||||
|
@ -335,7 +335,7 @@ end
|
||||
---
|
||||
--- 0-indexed (row, col) tuple. Defaults to cursor position in the
|
||||
--- current window. Required if {bufnr} is not the current buffer
|
||||
--- @field pos { [1]: integer, [2]: integer }?
|
||||
--- @field pos [integer, integer]?
|
||||
---
|
||||
--- Parser language. (default: from buffer filetype)
|
||||
--- @field lang string?
|
||||
|
@ -174,7 +174,7 @@ end
|
||||
--- @param source_buf integer
|
||||
--- @param inspect_buf integer
|
||||
--- @param inspect_win integer
|
||||
--- @param pos? { [1]: integer, [2]: integer }
|
||||
--- @param pos? [integer, integer]
|
||||
local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, inspect_win, pos)
|
||||
api.nvim_buf_clear_namespace(inspect_buf, treeview.ns, 0, -1)
|
||||
|
||||
|
@ -6,7 +6,7 @@ local DEP_API_METADATA = 'build/funcs_metadata.mpack'
|
||||
|
||||
--- @class vim.api.metadata
|
||||
--- @field name string
|
||||
--- @field parameters {[1]:string,[2]:string}[]
|
||||
--- @field parameters [string,string][]
|
||||
--- @field return_type string
|
||||
--- @field deprecated_since integer
|
||||
--- @field eval boolean
|
||||
@ -149,7 +149,7 @@ local function api_type(t)
|
||||
end
|
||||
|
||||
--- @param f string
|
||||
--- @param params {[1]:string,[2]:string}[]|true
|
||||
--- @param params [string,string][]|true
|
||||
--- @return string
|
||||
local function render_fun_sig(f, params)
|
||||
local param_str --- @type string
|
||||
@ -158,7 +158,7 @@ local function render_fun_sig(f, params)
|
||||
else
|
||||
param_str = table.concat(
|
||||
vim.tbl_map(
|
||||
--- @param v {[1]:string,[2]:string}
|
||||
--- @param v [string,string]
|
||||
--- @return string
|
||||
function(v)
|
||||
return v[1]
|
||||
@ -178,8 +178,8 @@ end
|
||||
|
||||
--- Uniquify names
|
||||
--- Fix any names that are lua keywords
|
||||
--- @param params {[1]:string,[2]:string,[3]:string}[]
|
||||
--- @return {[1]:string,[2]:string,[3]:string}[]
|
||||
--- @param params [string,string,string][]
|
||||
--- @return [string,string,string][]
|
||||
local function process_params(params)
|
||||
local seen = {} --- @type table<string,true>
|
||||
local sfx = 1
|
||||
@ -245,7 +245,7 @@ local function get_api_meta()
|
||||
for _, fun in pairs(functions) do
|
||||
local deprecated = fun.deprecated_since ~= nil
|
||||
|
||||
local params = {} --- @type {[1]:string,[2]:string}[]
|
||||
local params = {} --- @type [string,string][]
|
||||
for _, p in ipairs(fun.params) do
|
||||
params[#params + 1] = {
|
||||
p.name,
|
||||
|
@ -935,7 +935,7 @@ local function gen_target(cfg)
|
||||
|
||||
expand_files(cfg.files)
|
||||
|
||||
--- @type table<string,{[1]:table<string,nvim.luacats.parser.class>, [2]: nvim.luacats.parser.fun[], [3]: string[]}>
|
||||
--- @type table<string,[table<string,nvim.luacats.parser.class>, nvim.luacats.parser.fun[], string[]]>
|
||||
local file_results = {}
|
||||
|
||||
--- @type table<string,nvim.luacats.parser.class>
|
||||
|
@ -19,7 +19,7 @@
|
||||
--- @field returns_desc? string
|
||||
--- @field signature? string
|
||||
--- @field desc? string
|
||||
--- @field params {[1]:string, [2]:string, [3]:string}[]
|
||||
--- @field params [string, string, string][]
|
||||
--- @field lua? false Do not render type information
|
||||
--- @field tags? string[] Extra tags
|
||||
--- @field data? string Used by gen_eval.lua
|
||||
@ -11672,7 +11672,7 @@ M.funcs = {
|
||||
]=],
|
||||
name = 'synconcealed',
|
||||
params = { { 'lnum', 'integer' }, { 'col', 'integer' } },
|
||||
returns = '{[1]: integer, [2]: string, [3]: integer}',
|
||||
returns = '[integer, string, integer]',
|
||||
signature = 'synconcealed({lnum}, {col})',
|
||||
},
|
||||
synstack = {
|
||||
|
@ -148,7 +148,7 @@ local get_defaults = function(d, n)
|
||||
return value_dumpers[type(d)](d)
|
||||
end
|
||||
|
||||
--- @type {[1]:string,[2]:string}[]
|
||||
--- @type [string,string][]
|
||||
local defines = {}
|
||||
|
||||
--- @param i integer
|
||||
|
@ -443,7 +443,7 @@ describe('vim.lsp.completion: protocol', function()
|
||||
end)
|
||||
end
|
||||
|
||||
--- @param pos { [1]: integer, [2]: integer }
|
||||
--- @param pos [integer, integer]
|
||||
local function trigger_at_pos(pos)
|
||||
exec_lua(
|
||||
[[
|
||||
|
@ -256,7 +256,7 @@ end
|
||||
--- @param notification_cb function?
|
||||
--- @param setup_cb function?
|
||||
--- @param timeout integer
|
||||
--- @return {[1]: integer, [2]: string}
|
||||
--- @return [integer, string]
|
||||
function M.run_session(lsession, request_cb, notification_cb, setup_cb, timeout)
|
||||
local on_request --- @type function?
|
||||
local on_notification --- @type function?
|
||||
|
@ -438,7 +438,7 @@ end
|
||||
--- @field mouse_enabled? boolean
|
||||
---
|
||||
--- @field win_viewport? table<integer,table<string,integer>>
|
||||
--- @field float_pos? {[1]:integer,[2]:integer}
|
||||
--- @field float_pos? [integer,integer]
|
||||
--- @field hl_groups? table<string,integer>
|
||||
---
|
||||
--- The following keys should be used to expect the state of various ext_
|
||||
|
Loading…
Reference in New Issue
Block a user