mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 07:41:27 +00:00
feat(lsp): use stricter types for methods
This change modifies gen_lsp.lua so alias types are generated for various types of lsp methods to distinguish between notifications and requests: - vim.lsp.protocol.Method.ServerToClient.Request - vim.lsp.protocol.Method.ServerToClient.Notification - vim.lsp.protocol.Method.ClientToServer.Request - vim.lsp.protocol.Method.ClientToServer.Notification These types are then used instead of `string` where appropriate.
This commit is contained in:
committed by
Lewis Russell
parent
34b4df774d
commit
d7e0d46ffa
@@ -158,7 +158,7 @@ local function request_with_opts(name, params, opts)
|
||||
lsp.buf_request(0, name, params, req_handler)
|
||||
end
|
||||
|
||||
---@param method string
|
||||
---@param method vim.lsp.protocol.Method.ClientToServer.Request
|
||||
---@param opts? vim.lsp.LocationOpts
|
||||
local function get_locations(method, opts)
|
||||
opts = opts or {}
|
||||
@@ -814,7 +814,7 @@ function M.document_symbol(opts)
|
||||
end
|
||||
|
||||
--- @param client_id integer
|
||||
--- @param method string
|
||||
--- @param method vim.lsp.protocol.Method.ClientToServer.Request
|
||||
--- @param params table
|
||||
--- @param handler? lsp.Handler
|
||||
--- @param bufnr? integer
|
||||
@@ -845,7 +845,7 @@ local hierarchy_methods = {
|
||||
[ms.callHierarchy_outgoingCalls] = 'call',
|
||||
}
|
||||
|
||||
--- @param method string
|
||||
--- @param method vim.lsp.protocol.Method.ClientToServer.Request
|
||||
local function hierarchy(method)
|
||||
local kind = hierarchy_methods[method]
|
||||
if not kind then
|
||||
|
||||
Reference in New Issue
Block a user