fix(lsp): enable() does not activate inlay hints on open buffers #28629

Problem:
inlay_hint `enable(<no args>)` does not activate inlay hints on open
buffers. If a buffer does not have a corresponding `bufstate` in
`bufstates`, then `enable` all buffers will not take effect on it.

Solution:
Make the effective range determined by the loaded buffers.

Fix #28624
This commit is contained in:
Yi Ming 2024-05-07 17:30:19 +08:00 committed by GitHub
parent d8deb91819
commit c3c673cdec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -429,7 +429,7 @@ function M.enable(enable, filter)
if filter.bufnr == nil then
globalstate.enabled = enable
for bufnr, _ in pairs(bufstates) do
for _, bufnr in ipairs(api.nvim_list_bufs()) do
if api.nvim_buf_is_loaded(bufnr) then
if enable == false then
_disable(bufnr)