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
This commit is contained in:
David
2025-10-17 00:39:53 +08:00
committed by GitHub
parent b459bf5961
commit 371ad48135
3 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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'

View File

@@ -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