fix(lua): improve annotations for stricter luals diagnostics (#24609)

Problem: luals returns stricter diagnostics with bundled luarc.json
Solution: Improve some function and type annotations:

* use recognized uv.* types 
* disable diagnostic for global `vim` in shared.lua
* docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type)
* add type alias for lpeg pattern
* fix return annotation for `vim.secure.trust`
* rename local Range object in vim.version (shadows `Range` in vim.treesitter)
* fix some "missing fields" warnings
* add missing required fields for test functions in eval.lua
* rename lsp meta files for consistency
This commit is contained in:
Christian Clason
2023-08-09 11:06:13 +02:00
committed by GitHub
parent 8afdc1f386
commit c43c745a14
25 changed files with 111 additions and 95 deletions

View File

@ -14,11 +14,11 @@ local uv = vim.uv
--- @field marked boolean whether this token has had extmarks applied
---
--- @class STCurrentResult
--- @field version integer document version associated with this result
--- @field result_id string resultId from the server; used with delta requests
--- @field highlights STTokenRange[] cache of highlight ranges for this document version
--- @field tokens integer[] raw token array as received by the server. used for calculating delta responses
--- @field namespace_cleared boolean whether the namespace was cleared for this result yet
--- @field version? integer document version associated with this result
--- @field result_id? string resultId from the server; used with delta requests
--- @field highlights? STTokenRange[] cache of highlight ranges for this document version
--- @field tokens? integer[] raw token array as received by the server. used for calculating delta responses
--- @field namespace_cleared? boolean whether the namespace was cleared for this result yet
---
--- @class STActiveRequest
--- @field request_id integer the LSP request ID of the most recent request sent to the server
@ -717,8 +717,7 @@ end
--- mark will be deleted by the semantic token engine when appropriate; for
--- example, when the LSP sends updated tokens. This function is intended for
--- use inside |LspTokenUpdate| callbacks.
---@param token (table) a semantic token, found as `args.data.token` in
--- |LspTokenUpdate|.
---@param token (table) a semantic token, found as `args.data.token` in |LspTokenUpdate|.
---@param bufnr (integer) the buffer to highlight
---@param client_id (integer) The ID of the |vim.lsp.client|
---@param hl_group (string) Highlight group name