fix(util.toggle): correctly toggle inlay_hints (#3202)

`is_enabled` also accepts a `filter` and when we initially toggle
`inlay_hints` on
[here](735f5905f8/lua/lazyvim/plugins/lsp/init.lua (L153)),
we pass a `bufnr` which sets the `inlay_hints` in the `bufstate` (see
[here](42aa69b076/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](42aa69b076/runtime/lua/vim/lsp/inlay_hint.lua (L376-L388))).
This commit is contained in:
Iordanis Petkakis 2024-05-17 21:06:17 +03:00 committed by GitHub
parent 735f5905f8
commit 23374f160a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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