mirror of
https://github.com/neovim/neovim.git
synced 2025-11-16 07:11:20 +00:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user