From 23374f160a5b1b947681d55add56ab6ab15e219e Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 17 May 2024 21:06:17 +0300 Subject: [PATCH] fix(util.toggle): correctly toggle `inlay_hints` (#3202) `is_enabled` also accepts a `filter` and when we initially toggle `inlay_hints` on [here](https://github.com/LazyVim/LazyVim/blob/735f5905f85fec0dd5210f2c835597caa5a409fb/lua/lazyvim/plugins/lsp/init.lua#L153), we pass a `bufnr` which sets the `inlay_hints` in the `bufstate` (see [here](https://github.com/neovim/neovim/blob/42aa69b076cb338e20b5b4656771f1873e8930d8/runtime/lua/vim/lsp/inlay_hint.lua#L407-L432)), but when we call `is_enabled` without a filter table the returned result if from the `globalstate` (see [here](https://github.com/neovim/neovim/blob/42aa69b076cb338e20b5b4656771f1873e8930d8/runtime/lua/vim/lsp/inlay_hint.lua#L376-L388)). --- lua/lazyvim/util/toggle.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index 9c224059..543d4c13 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -67,7 +67,7 @@ function M.inlay_hints(buf, value) ih(buf, value) elseif type(ih) == "table" and ih.enable then if value == nil then - value = not ih.is_enabled(buf) + value = not ih.is_enabled({ bufnr = buf or 0 }) end ih.enable(value, { bufnr = buf }) end