Merge #33660 from MariaSolOs/supports-dynamic

This commit is contained in:
Justin M. Keyes
2025-04-27 04:34:05 -07:00
committed by GitHub
3 changed files with 104 additions and 5 deletions

View File

@ -7,7 +7,7 @@ Generates lua-ls annotations for lsp.
Also updates types in runtime/lua/vim/lsp/protocol.lua
Usage:
src/gen/gen_lsp.lua [options]
nvim -l src/gen/gen_lsp.lua [options]
Options:
--version <version> LSP version to use (default: 3.18)
@ -198,12 +198,32 @@ local function write_to_vim_protocol(protocol)
end
do -- capabilities
vim.list_extend(output, {
'',
'-- stylua: ignore start',
'-- Generated by gen_lsp.lua, keep at end of file.',
'--- Maps method names to the required client capability',
'protocol._request_name_to_client_capability = {',
})
for _, item in ipairs(all) do
if item.clientCapability then
output[#output + 1] = (" ['%s'] = { %s },"):format(
item.method,
"'" .. item.clientCapability:gsub('%.', "', '") .. "'"
)
end
end
output[#output + 1] = '}'
output[#output + 1] = '-- stylua: ignore end'
vim.list_extend(output, {
'',
'-- stylua: ignore start',
'-- Generated by gen_lsp.lua, keep at end of file.',
'--- Maps method names to the required server capability',
'protocol._request_name_to_capability = {',
'protocol._request_name_to_server_capability = {',
})
for _, item in ipairs(all) do