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

Commit

Permalink
fix: disable diagnostic when buffer doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
haorenW1025 committed Jun 5, 2020
1 parent 6adf7ee commit 8226360
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ function M.diagnostics_loclist(local_result)
end

function M.publish_diagnostics(bufnr)
if vim.fn.filereadable(vim.fn.expand("%")) == 0 then
return
end
if vim.fn.getcmdwintype() == ':' then return end
if #vim.lsp.buf_get_clients() == 0 then return end
local result = M.bufferDiagnostic[bufnr]
Expand All @@ -87,7 +84,9 @@ function M.publish_diagnostics(bufnr)
if vim.api.nvim_get_var('diagnostic_enable_virtual_text') == 1 then
util.buf_diagnostics_virtual_text(bufnr, result.diagnostics)
end
M.diagnostics_loclist(result)
if vim.fn.filereadable(vim.fn.expand("%")) == 0 then
M.diagnostics_loclist(result)
end

vim.schedule_wrap(function()
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")
Expand Down

0 comments on commit 8226360

Please sign in to comment.