refactor(lua): use tuple syntax everywhere #29111

This commit is contained in:
Ilia Choly
2024-06-04 09:06:02 -04:00
committed by GitHub
parent 61025c9e7a
commit 8cbb1f20e5
24 changed files with 53 additions and 54 deletions

View File

@@ -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
---

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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`)

View File

@@ -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>

View File

@@ -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,

View File

@@ -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

View File

@@ -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'))

View File

@@ -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

View File

@@ -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?

View File

@@ -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)