neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit fde0b487fb612e68de2ca11054560ca7f36c49b2
parent ddcfa8bb4a98402c76c2996c6248c699095c05e6
Author: skewb1k <skewb1kunix@gmail.com>
Date:   Tue, 16 Sep 2025 03:50:53 +0300

fix(lsp): avoid re-enabling `document_color` on `registerCapability` (#35774)

Problem: The registerCapability handler re-enables document_color,
making it impossible to disable it in LspAttach.

Solution: Enable it once on initialization and avoid re-enabling
on registerCapability.
Diffstat:
Mruntime/lua/vim/lsp.lua | 1-
Mruntime/lua/vim/lsp/client.lua | 4++++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -784,7 +784,6 @@ function lsp._set_defaults(client, bufnr) if client:supports_method(ms.textDocument_diagnostic) then lsp.diagnostic._enable(bufnr) end - lsp.document_color.enable(true, bufnr) end --- @deprecated diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua @@ -1087,6 +1087,10 @@ function Client:on_attach(bufnr) self:_text_document_did_open_handler(bufnr) lsp._set_defaults(self, bufnr) + -- `enable(true)` cannot be called from `_set_defaults` for features with dynamic registration, + -- because it overrides the state every time `client/registerCapability` is received. + -- To allow disabling it once in `LspAttach`, we enable it once here instead. + lsp.document_color.enable(true, bufnr) api.nvim_exec_autocmds('LspAttach', { buffer = bufnr,