one more nvim patch

This commit is contained in:
Gabriel Ebner 2022-01-12 20:27:49 +01:00
parent a7d3edef60
commit 15ed947ac1
2 changed files with 45 additions and 1 deletions

44
16904.patch Normal file

@ -0,0 +1,44 @@
From 4544d45155d45ce1d07408e3924bf6c2921cc66d Mon Sep 17 00:00:00 2001
From: Sam McCall <sam.mccall@gmail.com>
Date: Mon, 3 Jan 2022 22:34:24 +0100
Subject: [PATCH] fix(lsp): suppress ContentModified errors from UI
> If clients receive a ContentModified error, it generally should not
show it in the UI for the end-user. Clients can resend the request if
they know how to do so.
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#implementationConsiderations
Fixes https://github.com/neovim/neovim/issues/16900
---
runtime/lua/vim/lsp/handlers.lua | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index a1d3b2aa9455..a48302cc4b0e 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -439,14 +439,20 @@ for k, fn in pairs(M) do
})
if err then
- local client = vim.lsp.get_client_by_id(ctx.client_id)
- local client_name = client and client.name or string.format("client_id=%d", ctx.client_id)
-- LSP spec:
-- interface ResponseError:
-- code: integer;
-- message: string;
-- data?: string | number | boolean | array | object | null;
- return err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message)
+
+ -- Per LSP, don't show ContentModified error to the user.
+ if err.code ~= protocol.ErrorCodes.ContentModified then
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client_name = client and client.name or string.format("client_id=%d", ctx.client_id)
+
+ err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message)
+ end
+ return
end
return fn(err, result, ctx, config)

@ -5,7 +5,7 @@
nixpkgs.config.packageOverrides = pkgs: with pkgs; { nixpkgs.config.packageOverrides = pkgs: with pkgs; {
neovim-unwrapped = neovim-unwrapped.overrideDerivation (orig: { neovim-unwrapped = neovim-unwrapped.overrideDerivation (orig: {
patches = orig.patches ++ [ ./16382.patch ./16666.patch ./16670.patch ./16669.patch ]; patches = orig.patches ++ [ ./16382.patch ./16666.patch ./16670.patch ./16669.patch ./16904.patch ];
}); });
neovim-qt-unwrapped = neovim-qt-unwrapped.overrideDerivation (_: { neovim-qt-unwrapped = neovim-qt-unwrapped.overrideDerivation (_: {