fix(lsp): don't create an 'LspAttach' document_color autocommand

This commit is contained in:
Maria José Solano authored and Christian Clason committed 2025-04-24 21:03:44 +02:00
1 parent 8495d96238
commit 18e8839c80
1 file changed
+12 -19
+12 -19
View File
@@ -175,6 +175,18 @@ end
local function buf_enable(bufnr)
reset_bufstate(bufnr, true)
api.nvim_buf_attach(bufnr, false, {
on_reload = function(_, buf)
buf_clear(buf)
if bufstates[buf].enabled then
buf_refresh(buf)
end
end,
on_detach = function(_, buf)
buf_disable(buf)
end,
})
api.nvim_create_autocmd('LspNotify', {
buffer = bufnr,
group = document_color_augroup,
@@ -191,25 +203,6 @@ local function buf_enable(bufnr)
end,
})
api.nvim_create_autocmd('LspAttach', {
buffer = bufnr,
group = document_color_augroup,
desc = 'Enable document_color when LSP client attaches',
callback = function(args)
api.nvim_buf_attach(args.buf, false, {
on_reload = function(_, buf)
buf_clear(buf)
if bufstates[buf].enabled then
buf_refresh(buf)
end
end,
on_detach = function(_, buf)
buf_disable(buf)
end,
})
end,
})
api.nvim_create_autocmd('LspDetach', {
buffer = bufnr,
group = document_color_augroup,