mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(lsp): assert workspace/applyEdit receives params (#21945)
According to the specification `workspace/applyEdit` must be called with `ApplyWorkspaceEditParams`. So far the client just returned, which could lead to a misleading error on the server side because `workspace/applyEdit` must respond with a `ApplyWorkspaceEditResult`. This adds an assertion to clarify that the server is violating the specification. See https://github.com/neovim/neovim/issues/21925
This commit is contained in:

committed by
GitHub

parent
63e67468b4
commit
8e52d8a394
@@ -131,9 +131,10 @@ end
|
|||||||
|
|
||||||
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
|
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
|
||||||
M['workspace/applyEdit'] = function(_, workspace_edit, ctx)
|
M['workspace/applyEdit'] = function(_, workspace_edit, ctx)
|
||||||
if not workspace_edit then
|
assert(
|
||||||
return
|
workspace_edit,
|
||||||
end
|
'workspace/applyEdit must be called with `ApplyWorkspaceEditParams`. Server is violating the specification'
|
||||||
|
)
|
||||||
-- TODO(ashkan) Do something more with label?
|
-- TODO(ashkan) Do something more with label?
|
||||||
local client_id = ctx.client_id
|
local client_id = ctx.client_id
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
Reference in New Issue
Block a user