fix(lsp): check if inlay hints are enabled for a buffer before disabling (#24074)

disabling before enabling throws an error otherwise, because bufstate[bufnr]
doesn't exist
This commit is contained in:
Chinmay Dalal 2023-06-20 22:06:31 +05:30 committed by GitHub
parent 64f2691a98
commit d3e0352574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,9 +207,11 @@ end
---@private
function M.disable(bufnr)
bufnr = resolve_bufnr(bufnr)
clear(bufnr)
bufstates[bufnr].enabled = nil
bufstates[bufnr].timer = nil
if bufstates[bufnr] and bufstates[bufnr].enabled then
clear(bufnr)
bufstates[bufnr].enabled = nil
bufstates[bufnr].timer = nil
end
end
--- Toggle inlay hints for a buffer