refactor(lsp): typings for protocol constants

This commit is contained in:
Maria José Solano
2024-02-18 14:52:16 -08:00
committed by Lewis Russell
parent a9f578b7a5
commit cc15ba212c

View File

@@ -1,6 +1,6 @@
-- Protocol for the Microsoft Language Server Protocol (mslsp) --- @diagnostic disable: duplicate-doc-alias
local protocol = {} -- Protocol for the Microsoft Language Server Protocol (mslsp)
--[=[ --[=[
---@private ---@private
@@ -20,7 +20,7 @@ function transform_schema_to_table()
end end
--]=] --]=]
local constants = { local protocol = {
--- @enum lsp.DiagnosticSeverity --- @enum lsp.DiagnosticSeverity
DiagnosticSeverity = { DiagnosticSeverity = {
-- Reports an error. -- Reports an error.
@@ -313,7 +313,7 @@ local constants = {
}, },
} }
for k, v in pairs(constants) do for k, v in pairs(protocol) do
local tbl = vim.deepcopy(v, true) local tbl = vim.deepcopy(v, true)
vim.tbl_add_reverse_lookup(tbl) vim.tbl_add_reverse_lookup(tbl)
protocol[k] = tbl protocol[k] = tbl
@@ -723,7 +723,7 @@ function protocol.make_client_capabilities()
codeActionLiteralSupport = { codeActionLiteralSupport = {
codeActionKind = { codeActionKind = {
valueSet = (function() valueSet = (function()
local res = vim.tbl_values(constants.CodeActionKind) local res = vim.tbl_values(protocol.CodeActionKind)
table.sort(res) table.sort(res)
return res return res
end)(), end)(),