docs: fix lua type warnings (#28633)

This commit is contained in:
Maria José Solano 2024-05-04 15:08:17 -07:00 committed by GitHub
parent e948d7feba
commit efb44e0cad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 6 deletions

View File

@ -124,7 +124,7 @@ error('Cannot require a meta file')
--- @field commalist boolean
--- @field flaglist boolean
--- @field was_set boolean
--- @field last_set_id integer
--- @field last_set_sid integer
--- @field last_set_linenr integer
--- @field last_set_chan integer
--- @field type 'string'|'boolean'|'number'

View File

@ -127,3 +127,11 @@
--- @field skipcol integer
--- @field topfill integer
--- @field topline integer
--- @class vim.fn.getscriptinfo.ret
--- @field autoload false
--- @field functions? string[]
--- @field name string
--- @field sid string
--- @field variables? table<string, any>
--- @field version 1

View File

@ -3632,7 +3632,7 @@ function vim.fn.getregtype(regname) end
--- <
---
--- @param opts? table
--- @return any
--- @return vim.fn.getscriptinfo.ret[]
function vim.fn.getscriptinfo(opts) end
--- If {tabnr} is not specified, then information about all the

View File

@ -310,6 +310,7 @@ local function is_empty_or_default(bufnr, option)
end
local info = api.nvim_get_option_info2(option, { buf = bufnr })
---@param e vim.fn.getscriptinfo.ret
local scriptinfo = vim.tbl_filter(function(e)
return e.sid == info.last_set_sid
end, vim.fn.getscriptinfo())
@ -515,7 +516,7 @@ local function buf_attach(bufnr)
textDocument = {
uri = uri,
},
reason = protocol.TextDocumentSaveReason.Manual,
reason = protocol.TextDocumentSaveReason.Manual, ---@type integer
}
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'willSave') then
client.notify(ms.textDocument_willSave, params)
@ -899,7 +900,7 @@ end
--- a `client_id:result` map.
---@return function cancel Function that cancels all requests.
function lsp.buf_request_all(bufnr, method, params, handler)
local results = {} --- @type table<integer,{error:string, result:any}>
local results = {} --- @type table<integer,{error:lsp.ResponseError, result:any}>
local result_count = 0
local expected_result_count = 0
@ -940,7 +941,7 @@ end
---@return table<integer, {err: lsp.ResponseError, result: any}>? result Map of client_id:request_result.
---@return string? err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil.
function lsp.buf_request_sync(bufnr, method, params, timeout_ms)
local request_results
local request_results ---@type table
local cancel = lsp.buf_request_all(bufnr, method, params, function(it)
request_results = it

View File

@ -327,7 +327,7 @@ function M.get_captures_at_cursor(winnr)
end
--- Optional keyword arguments:
--- @class vim.treesitter.get_node.Opts
--- @class vim.treesitter.get_node.Opts : vim.treesitter.LanguageTree.tree_for_range.Opts
--- @inlinedoc
---
--- Buffer number (nil or 0 for current buffer)

View File

@ -4475,6 +4475,7 @@ M.funcs = {
]=],
name = 'getscriptinfo',
params = { { 'opts', 'table' } },
returns = 'vim.fn.getscriptinfo.ret[]',
signature = 'getscriptinfo([{opts}])',
},
gettabinfo = {