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

Commit 49abd2e

Browse files
committed
decide whether to overwrite location list base on the title
1 parent 9dc00d6 commit 49abd2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lua/diagnostic.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ function M.publish_diagnostics(bufnr)
8686
if vim.api.nvim_get_var('diagnostic_enable_virtual_text') == 1 then
8787
util.buf_diagnostics_virtual_text(bufnr, diagnostics)
8888
end
89-
vim.fn.setloclist(0, {}, 'r')
90-
M.diagnostics_loclist(diagnostics)
89+
local title = vim.fn.getloclist(vim.fn.winnr(), {title= 1})['title']
90+
if title == "Language Server" or string.len(title) == 0 then
91+
vim.fn.setloclist(0, {}, 'r')
92+
M.diagnostics_loclist(diagnostics)
93+
end
94+
M.trigger_diagnostics_changed()
9195
end
9296

9397
M.trigger_diagnostics_changed = vim.schedule_wrap(function()

0 commit comments

Comments
 (0)