diff options
| author | Maria José Solano <majosolano99@gmail.com> | 2025-04-20 14:54:31 -0700 |
|---|---|---|
| committer | Christian Clason <ch.clason+github@icloud.com> | 2025-04-21 11:35:29 +0200 |
| commit | d55330bcd13edc38c333475cc3369ef8e879fbb7 (patch) | |
| tree | 7c30dcd27e32d41c3e795dfa0dcfd5eed68f2a9c /runtime/lua/vim | |
| parent | 351613bc1fce84acc368d944a635e7b696182c84 (diff) | |
| download | rneovim-d55330bcd13edc38c333475cc3369ef8e879fbb7.tar.gz rneovim-d55330bcd13edc38c333475cc3369ef8e879fbb7.tar.bz2 rneovim-d55330bcd13edc38c333475cc3369ef8e879fbb7.zip | |
refactor(lsp): use method type annotations for parameters
Diffstat (limited to 'runtime/lua/vim')
| -rw-r--r-- | runtime/lua/vim/lsp.lua | 8 | ||||
| -rw-r--r-- | runtime/lua/vim/lsp/client.lua | 2 | ||||
| -rw-r--r-- | runtime/lua/vim/lsp/rpc.lua | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index c618be7fd9..544466a9fc 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -43,7 +43,7 @@ lsp._resolve_to_request = { ---@private --- Called by the client when trying to call a method that's not --- supported in any of the servers registered for the current buffer. ----@param method (string) name of the method +---@param method (vim.lsp.protocol.Method.ClientToServer) name of the method function lsp._unsupported_method(method) local msg = string.format( 'method %s is not supported by any of the servers registered for the current buffer', @@ -1183,7 +1183,7 @@ api.nvim_create_autocmd('VimLeavePre', { --- buffer. --- ---@param bufnr (integer) Buffer handle, or 0 for current. ----@param method (string) LSP method name +---@param method (vim.lsp.protocol.Method.ClientToServer.Request) LSP method name ---@param params? table|(fun(client: vim.lsp.Client, bufnr: integer): table?) Parameters to send to the server ---@param handler? lsp.Handler See |lsp-handler| --- If nil, follows resolution strategy defined in |lsp-handler-configuration| @@ -1246,7 +1246,7 @@ end ---@since 7 --- ---@param bufnr (integer) Buffer handle, or 0 for current. ----@param method (string) LSP method name +---@param method (vim.lsp.protocol.Method.ClientToServer.Request) LSP method name ---@param params? table|(fun(client: vim.lsp.Client, bufnr: integer): table?) Parameters to send to the server. --- Can also be passed as a function that returns the params table for cases where --- parameters are specific to the client. @@ -1317,7 +1317,7 @@ end ---@since 7 --- ---@param bufnr (integer|nil) The number of the buffer ----@param method (string) Name of the request method +---@param method (vim.lsp.protocol.Method.ClientToServer.Notification) Name of the request method ---@param params (any) Arguments to send to the server --- ---@return boolean success true if any client returns true; false otherwise diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua index 2219876a3d..d8d46e425c 100644 --- a/runtime/lua/vim/lsp/client.lua +++ b/runtime/lua/vim/lsp/client.lua @@ -1100,7 +1100,7 @@ end --- @private --- Handles a request from an LSP server by invoking the corresponding handler. --- ---- @param method (string) LSP method name +--- @param method (vim.lsp.protocol.Method.ServerToClient) LSP method name --- @param params (table) The parameters for that method --- @return any result --- @return lsp.ResponseError error code and message set in case an exception happens during the request. diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 637cda84d3..51b1f85d78 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -482,7 +482,7 @@ local function public_client(client) --- Sends a request to the LSP server and runs {callback} upon response. --- - ---@param method (string) The invoked LSP method + ---@param method (vim.lsp.protocol.Method.ClientToServer.Request) 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 @@ -493,7 +493,7 @@ local function public_client(client) end --- Sends a notification to the LSP server. - ---@param method (string) The invoked LSP method + ---@param method (vim.lsp.protocol.Method.ClientToServer.Notification) The invoked LSP method ---@param params (table?) Parameters for the invoked LSP method ---@return boolean `true` if notification could be sent, `false` if not function result.notify(method, params) |