fix(lsp): ensure bufstate when calling vim.lsp.document_color.is_enabled

This commit is contained in:
Maria José Solano
2025-04-24 10:25:27 -07:00
committed by Christian Clason
parent 9ff1239634
commit 8495d96238
2 changed files with 16 additions and 1 deletions

View File

@@ -238,7 +238,13 @@ end
function M.is_enabled(bufnr)
vim.validate('bufnr', bufnr, 'number', true)
return bufstates[vim._resolve_bufnr(bufnr)].enabled
bufnr = vim._resolve_bufnr(bufnr)
if not bufstates[bufnr] then
reset_bufstate(bufnr, false)
end
return bufstates[bufnr].enabled
end
--- Enables document highlighting from the given language client in the given buffer.