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

Commit b61d28a

Browse files
committed
fix: not properly fix the overwriting issue
1 parent 62d658d commit b61d28a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/diagnostic.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ function M.publish_diagnostics(bufnr)
7777
local diagnostics = vim.lsp.util.diagnostics_by_buf[bufnr]
7878
if diagnostics == nil then return end
7979
util.align_diagnostic_indices(diagnostics)
80-
vim.fn.setloclist(0, {}, 'r')
8180
if vim.api.nvim_get_var('diagnostic_enable_underline') == 1 then
8281
vim.lsp.util.buf_diagnostics_underline(bufnr, diagnostics)
8382
end
@@ -87,7 +86,10 @@ function M.publish_diagnostics(bufnr)
8786
if vim.api.nvim_get_var('diagnostic_enable_virtual_text') == 1 then
8887
util.buf_diagnostics_virtual_text(bufnr, diagnostics)
8988
end
90-
M.diagnostics_loclist(diagnostics)
89+
if #vim.fn.getloclist(vim.fn.winnr()) == 0 then
90+
vim.fn.setloclist(0, {}, 'r')
91+
M.diagnostics_loclist(diagnostics)
92+
end
9193
M.trigger_diagnostics_changed()
9294
end
9395

0 commit comments

Comments
 (0)