aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2023-01-22 18:54:09 +0100
committerGitHub <noreply@github.com>2023-01-22 18:54:09 +0100
commit8e52d8a394799ede43ae5e80574f12dede9bc13e (patch)
treeb5f377e5c3d5ec56f0db28fe0a4d07de910643a6 /runtime/lua/vim/lsp/handlers.lua
parent63e67468b45edcc899de24a1940985bccf68f66a (diff)
downloadrneovim-8e52d8a394799ede43ae5e80574f12dede9bc13e.tar.gz
rneovim-8e52d8a394799ede43ae5e80574f12dede9bc13e.tar.bz2
rneovim-8e52d8a394799ede43ae5e80574f12dede9bc13e.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index b383ca1c35..5096100a60 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -131,9 +131,10 @@ end
--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
M['workspace/applyEdit'] = function(_, workspace_edit, ctx)
- if not workspace_edit then
- return
- end
+ assert(
+ workspace_edit,
+ 'workspace/applyEdit must be called with `ApplyWorkspaceEditParams`. Server is violating the specification'
+ )
-- TODO(ashkan) Do something more with label?
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)