mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
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:
@ -1,9 +1,9 @@
|
||||
--[[
|
||||
Generates lua-ls annotations for lsp
|
||||
USAGE:
|
||||
nvim -l scripts/gen_lsp.lua gen # this will overwrite runtime/lua/vim/lsp/types/protocol.lua
|
||||
nvim -l scripts/gen_lsp.lua gen # this will overwrite runtime/lua/vim/lsp/_meta/protocol.lua
|
||||
nvim -l scripts/gen_lsp.lua gen --version 3.18 --build/new_lsp_types.lua
|
||||
nvim -l scripts/gen_lsp.lua gen --version 3.18 --out runtime/lua/vim/lsp/types/protocol.lua
|
||||
nvim -l scripts/gen_lsp.lua gen --version 3.18 --out runtime/lua/vim/lsp/_meta/protocol.lua
|
||||
nvim -l scripts/gen_lsp.lua gen --version 3.18 --methods
|
||||
--]]
|
||||
|
||||
@ -110,7 +110,7 @@ function M.gen(opt)
|
||||
'--[[',
|
||||
'This file is autogenerated from scripts/gen_lsp.lua',
|
||||
'Regenerate:',
|
||||
[=[nvim -l scripts/gen_lsp.lua gen --version 3.18 --runtime/lua/vim/lsp/types/protocol.lua]=],
|
||||
[=[nvim -l scripts/gen_lsp.lua gen --version 3.18 --runtime/lua/vim/lsp/_meta/protocol.lua]=],
|
||||
'--]]',
|
||||
'',
|
||||
'---@alias lsp.null nil',
|
||||
@ -264,7 +264,7 @@ function M.gen(opt)
|
||||
end
|
||||
|
||||
local opt = {
|
||||
output_file = 'runtime/lua/vim/lsp/types/protocol.lua',
|
||||
output_file = 'runtime/lua/vim/lsp/_meta/protocol.lua',
|
||||
version = nil,
|
||||
methods = nil,
|
||||
}
|
||||
|
Reference in New Issue
Block a user