aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-06-19 03:48:12 -0700
committerGitHub <noreply@github.com>2025-06-19 03:48:12 -0700
commit0dc900d744434f9792495cd41a36eecdde587fbe (patch)
tree9735d74d518e8255f20a585191efe2c93896dfab /runtime/lua/vim
parent150513a163d352b8e33985fdfaa0547ec7f2df9e (diff)
downloadrneovim-0dc900d744434f9792495cd41a36eecdde587fbe.tar.gz
rneovim-0dc900d744434f9792495cd41a36eecdde587fbe.tar.bz2
rneovim-0dc900d744434f9792495cd41a36eecdde587fbe.zip
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.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp/document_color.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/document_color.lua b/runtime/lua/vim/lsp/document_color.lua
index f721f1536d..ff1b557b5e 100644
--- a/runtime/lua/vim/lsp/document_color.lua
+++ b/runtime/lua/vim/lsp/document_color.lua
@@ -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)