fix(float): only clear diagnostics for valid buffers

This commit is contained in:
Folke Lemaitre 2023-01-13 09:00:38 +01:00
parent b73312aa32
commit 7b0d1a7866
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 1 additions and 1 deletions

View File

@ -173,12 +173,12 @@ function M:close()
local win = self.win
self.win = nil
self.buf = nil
vim.diagnostic.reset(Config.ns, buf)
vim.schedule(function()
if win and vim.api.nvim_win_is_valid(win) then
vim.api.nvim_win_close(win, true)
end
if buf and vim.api.nvim_buf_is_valid(buf) then
vim.diagnostic.reset(Config.ns, buf)
vim.api.nvim_buf_delete(buf, { force = true })
end
end)