build: replace LuaLS with EmmyLua

Problem: LuaLS struggles with the generics used in Nvim's runtime,
requiring broad diagnostic suppressions. Indexing is also slow.

Solution: Use EmmyLua for type checks in the build and CI. It offers
more sophisticated type checking, substantially better support for
generics, and much better flow analysis.

Correct the affected annotations. Use `@internal`, supported directly by
EmmyLua, instead of `@nodoc` for shared internal declarations, and
support it in the help parser.

AI-assisted
This commit is contained in:
Lewis Russell
2026-09-07 11:43:51 +01:00
committed by Lewis Russell
parent cd52c77cd5
commit 65ef6fdaee
48 changed files with 231 additions and 159 deletions

View File

@@ -675,14 +675,15 @@ function M.format(opts)
return util.make_given_range_params(r.start, r['end'], bufnr, client.offset_encoding).range
end
local ret = params --[[@as lsp.DocumentFormattingParams|lsp.DocumentRangeFormattingParams|lsp.DocumentRangesFormattingParams]]
--- @type lsp.DocumentFormattingParams|lsp.DocumentRangeFormattingParams|lsp.DocumentRangesFormattingParams
local ret = params
if passed_multiple_ranges then
--- @cast range {start:[integer,integer],end:[integer, integer]}[]
ret = params --[[@as lsp.DocumentRangesFormattingParams]]
--- @cast ret lsp.DocumentRangesFormattingParams
ret.ranges = vim.tbl_map(to_lsp_range, range)
elseif range then
--- @cast range {start:[integer,integer],end:[integer, integer]}
ret = params --[[@as lsp.DocumentRangeFormattingParams]]
--- @cast ret lsp.DocumentRangeFormattingParams
ret.range = to_lsp_range(range)
end
return ret