mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
fix(lsp): clear document_color autocmds #34573
**Problem:** When enabling document_color multiple times for the same buffer (or when toggling it on and off), duplicate autocmds are created since the previous ones are not cleared. **Solution:** Clear the appropriate buffer-local autocmds when enabling/disabling document color functionality.
This commit is contained in:
@ -182,11 +182,19 @@ end
|
||||
local function buf_disable(bufnr)
|
||||
buf_clear(bufnr)
|
||||
reset_bufstate(bufnr, false)
|
||||
api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
group = document_color_augroup,
|
||||
})
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
local function buf_enable(bufnr)
|
||||
reset_bufstate(bufnr, true)
|
||||
api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
group = document_color_augroup,
|
||||
})
|
||||
|
||||
api.nvim_buf_attach(bufnr, false, {
|
||||
on_reload = function(_, buf)
|
||||
|
Reference in New Issue
Block a user