From 49abd2e71772f6976b7e1360782570535069bc94 Mon Sep 17 00:00:00 2001 From: haorenW1025 Date: Wed, 16 Sep 2020 15:05:41 +0800 Subject: [PATCH] decide whether to overwrite location list base on the title --- lua/diagnostic.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/diagnostic.lua b/lua/diagnostic.lua index 5d813c5..3b64dca 100644 --- a/lua/diagnostic.lua +++ b/lua/diagnostic.lua @@ -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()