aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2023-08-03 17:52:21 +0800
committerGitHub <noreply@github.com>2023-08-03 02:52:21 -0700
commit214b125132778c5d51d4d7e673d31a9be835e150 (patch)
treee4a9e7b7ad7e5342c4f1bef91ec8c391814e8c1c /scripts
parent4a06de40e7c5bfe3be8f243b23b1676034fc6b08 (diff)
downloadrneovim-214b125132778c5d51d4d7e673d31a9be835e150.tar.gz
rneovim-214b125132778c5d51d4d7e673d31a9be835e150.tar.bz2
rneovim-214b125132778c5d51d4d7e673d31a9be835e150.zip
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_lsp.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/gen_lsp.lua b/scripts/gen_lsp.lua
index ef9d6c41df..a1bcce4135 100644
--- a/scripts/gen_lsp.lua
+++ b/scripts/gen_lsp.lua
@@ -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 })