diff --git a/runtime/lua/vim/lsp/_meta.lua b/runtime/lua/vim/lsp/_meta.lua index b12156451e..b4e0b51137 100644 --- a/runtime/lua/vim/lsp/_meta.lua +++ b/runtime/lua/vim/lsp/_meta.lua @@ -5,7 +5,7 @@ error('Cannot require a meta file') ---@alias lsp.MultiHandler fun(results: table, context: lsp.HandlerContext, config?: table): ...any ---@class lsp.HandlerContext ----@field method string +---@field method vim.lsp.protocol.Method ---@field client_id integer ---@field bufnr? integer ---@field params? any diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua index 9b8013b536..172aecb90e 100644 --- a/runtime/lua/vim/lsp/_meta/protocol.lua +++ b/runtime/lua/vim/lsp/_meta/protocol.lua @@ -2433,7 +2433,7 @@ error('Cannot require a meta file') ---@field id string --- ---The method / capability to register for. ----@field method string +---@field method vim.lsp.protocol.Method --- ---Options necessary for the registration. ---@field registerOptions? lsp.LSPAny @@ -2446,7 +2446,7 @@ error('Cannot require a meta file') ---@field id string --- ---The method to unregister for. ----@field method string +---@field method vim.lsp.protocol.Method ---The initialize parameters ---@class lsp._InitializeParams: lsp.WorkDoneProgressParams diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index a1a9a5bb77..d38bb3bbf7 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -263,6 +263,7 @@ function M.on_diagnostic(error, result, ctx) if error ~= nil and error.code == protocol.ErrorCodes.ServerCancelled then if error.data == nil or error.data.retriggerRequest ~= false then local client = assert(lsp.get_client_by_id(ctx.client_id)) + ---@diagnostic disable-next-line: param-type-mismatch client:request(ctx.method, ctx.params) end return diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 7ec578d874..74f6b299c9 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -115,7 +115,7 @@ end local default_dispatchers = { --- Default dispatcher for notifications sent to an LSP server. --- - ---@param method string The invoked LSP method + ---@param method vim.lsp.protocol.Method The invoked LSP method ---@param params table Parameters for the invoked LSP method notification = function(method, params) log.debug('notification', method, params) @@ -123,7 +123,7 @@ local default_dispatchers = { --- Default dispatcher for requests sent to an LSP server. --- - ---@param method string The invoked LSP method + ---@param method vim.lsp.protocol.Method The invoked LSP method ---@param params table Parameters for the invoked LSP method ---@return any result (always nil for the default dispatchers) ---@return lsp.ResponseError error `vim.lsp.protocol.ErrorCodes.MethodNotFound` @@ -226,7 +226,7 @@ end ---@package --- Sends a notification to the LSP server. ----@param method string The invoked LSP method +---@param method vim.lsp.protocol.Method The invoked LSP method ---@param params any Parameters for the invoked LSP method ---@return boolean `true` if notification could be sent, `false` if not function Client:notify(method, params) @@ -251,7 +251,7 @@ end ---@package --- Sends a request to the LSP server and runs {callback} upon response. |vim.lsp.rpc.request()| --- ----@param method string The invoked LSP method +---@param method vim.lsp.protocol.Method The invoked LSP method ---@param params table? Parameters for the invoked LSP method ---@param callback fun(err?: lsp.ResponseError, result: any) Callback to invoke ---@param notify_reply_callback? fun(message_id: integer) Callback to invoke as soon as a request is no longer pending diff --git a/src/gen/gen_lsp.lua b/src/gen/gen_lsp.lua index 39a3588051..9d47eeee37 100755 --- a/src/gen/gen_lsp.lua +++ b/src/gen/gen_lsp.lua @@ -30,7 +30,7 @@ Options: --- @field messageDirection string --- @field clientCapability? string --- @field serverCapability? string ---- @field method string +--- @field method vim.lsp.protocol.Method --- @field params? any --- @field proposed? boolean --- @field registrationMethod? string