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

Commit

Permalink
decide whether to overwrite location list base on the title
Browse files Browse the repository at this point in the history
  • Loading branch information
haorenW1025 committed Sep 16, 2020
1 parent 9dc00d6 commit 49abd2e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ function M.publish_diagnostics(bufnr)
if vim.api.nvim_get_var('diagnostic_enable_virtual_text') == 1 then
util.buf_diagnostics_virtual_text(bufnr, diagnostics)
end
vim.fn.setloclist(0, {}, 'r')
M.diagnostics_loclist(diagnostics)
local title = vim.fn.getloclist(vim.fn.winnr(), {title= 1})['title']
if title == "Language Server" or string.len(title) == 0 then
vim.fn.setloclist(0, {}, 'r')
M.diagnostics_loclist(diagnostics)
end
M.trigger_diagnostics_changed()
end

M.trigger_diagnostics_changed = vim.schedule_wrap(function()
Expand Down

0 comments on commit 49abd2e

Please sign in to comment.