Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 8226360

Browse files
committed
fix: disable diagnostic when buffer doesn't exist
1 parent 6adf7ee commit 8226360

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lua/diagnostic.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ function M.diagnostics_loclist(local_result)
6969
end
7070

7171
function M.publish_diagnostics(bufnr)
72-
if vim.fn.filereadable(vim.fn.expand("%")) == 0 then
73-
return
74-
end
7572
if vim.fn.getcmdwintype() == ':' then return end
7673
if #vim.lsp.buf_get_clients() == 0 then return end
7774
local result = M.bufferDiagnostic[bufnr]
@@ -87,7 +84,9 @@ function M.publish_diagnostics(bufnr)
8784
if vim.api.nvim_get_var('diagnostic_enable_virtual_text') == 1 then
8885
util.buf_diagnostics_virtual_text(bufnr, result.diagnostics)
8986
end
90-
M.diagnostics_loclist(result)
87+
if vim.fn.filereadable(vim.fn.expand("%")) == 0 then
88+
M.diagnostics_loclist(result)
89+
end
9190

9291
vim.schedule_wrap(function()
9392
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")

0 commit comments

Comments
 (0)