mirror of
https://github.com/neovim/neovim.git
synced 2026-01-04 02:17:09 +10:00
fix(gen_lsp.lua): no notifications in lsp.Methods #24530
Problem: - Notifications are missing from `lsp.Methods`. - Need a way to represent `$/` prefixed methods. Solution: - Generate notifications. - Use "dollar_" prefix for `$/` methods.
This commit is contained in:
@@ -35,7 +35,8 @@ end
|
||||
|
||||
-- Gets the Lua symbol for a given fully-qualified LSP method name.
|
||||
local function name(s)
|
||||
return s:gsub('/', '_', 3)
|
||||
-- "$/" prefix is special: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#dollarRequests
|
||||
return s:gsub('^%$', 'dollar'):gsub('/', '_')
|
||||
end
|
||||
|
||||
local function gen_methods(protocol)
|
||||
@@ -48,10 +49,11 @@ local function gen_methods(protocol)
|
||||
}
|
||||
local indent = (' '):rep(2)
|
||||
|
||||
table.sort(protocol.requests, function(a, b)
|
||||
local all = vim.list_extend(protocol.requests, protocol.notifications)
|
||||
table.sort(all, function(a, b)
|
||||
return name(a.method) < name(b.method)
|
||||
end)
|
||||
for _, item in ipairs(protocol.requests) do
|
||||
for _, item in ipairs(all) do
|
||||
if item.method then
|
||||
if item.documentation then
|
||||
local document = vim.split(item.documentation, '\n?\n', { trimempty = true })
|
||||
|
||||
Reference in New Issue
Block a user