neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 371ad48135edc0584ea38272251167f23a998f09
parent b459bf5961fd6bbd7c887d9c3751ff5dbbdcf55d
Author: David <30951234+Davidyz@users.noreply.github.com>
Date:   Fri, 17 Oct 2025 00:39:53 +0800

fix(lsp): replace `string` types with LSP method alias type annotations where appropriate. (#36180)

fix(lsp): replace `string` types with LSP method alias where appropriate
Diffstat:
Mruntime/lua/vim/lsp.lua | 2+-
Mruntime/lua/vim/lsp/client.lua | 4++--
Mruntime/lua/vim/lsp/rpc.lua | 8++++----
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -1087,7 +1087,7 @@ end --- @field name? string --- --- Only return clients supporting the given method ---- @field method? string +--- @field method? vim.lsp.protocol.Method.ClientToServer --- --- Also return uninitialized clients. --- @field package _uninitialized? boolean diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua @@ -649,7 +649,7 @@ end --- Returns the handler associated with an LSP method. --- Returns the default handler if the user hasn't set a custom one. --- ---- @param method (string) LSP method name +--- @param method (vim.lsp.protocol.Method) LSP method name --- @return lsp.Handler? handler for the given method, if defined, or the default from |vim.lsp.handlers| function Client:_resolve_handler(method) return self.handlers[method] or lsp.handlers[method] @@ -659,7 +659,7 @@ end --- @param id integer --- @param req_type 'pending'|'complete'|'cancel' --- @param bufnr? integer (only required for req_type='pending') ---- @param method? string (only required for req_type='pending') +--- @param method? vim.lsp.protocol.Method (only required for req_type='pending') function Client:_process_request(id, req_type, bufnr, method) local pending = req_type == 'pending' diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua @@ -106,8 +106,8 @@ end --- Dispatchers for LSP message types. --- @class vim.lsp.rpc.Dispatchers --- @inlinedoc ---- @field notification fun(method: string, params: table) ---- @field server_request fun(method: string, params: table): any?, lsp.ResponseError? +--- @field notification fun(method: vim.lsp.protocol.Method.ClientToServer.Notification, params: table) +--- @field server_request fun(method: vim.lsp.protocol.Method.ClientToServer.Request, params: table): any?, lsp.ResponseError? --- @field on_exit fun(code: integer, signal: integer) --- @field on_error fun(code: integer, err: any) @@ -460,10 +460,10 @@ end --- @class vim.lsp.rpc.PublicClient --- --- See [vim.lsp.rpc.request()] ---- @field request fun(method: string, params: table?, callback: fun(err?: lsp.ResponseError, result: any), notify_reply_callback?: fun(message_id: integer)):boolean,integer? +--- @field request fun(method: vim.lsp.protocol.Method.ClientToServer.Request, params: table?, callback: fun(err?: lsp.ResponseError, result: any), notify_reply_callback?: fun(message_id: integer)):boolean,integer? --- --- See [vim.lsp.rpc.notify()] ---- @field notify fun(method: string, params: any): boolean +--- @field notify fun(method: vim.lsp.protocol.Method.ClientToServer.Notification, params: any): boolean --- --- Indicates if the RPC is closing. --- @field is_closing fun(): boolean