From 62d658d2e3e11b53e1f053931985801375129184 Mon Sep 17 00:00:00 2001 From: haorenW1025 Date: Tue, 15 Sep 2020 20:47:27 +0800 Subject: [PATCH] avoid overwriting users location list --- lua/diagnostic.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/diagnostic.lua b/lua/diagnostic.lua index 2ff67af..667c380 100644 --- a/lua/diagnostic.lua +++ b/lua/diagnostic.lua @@ -66,7 +66,9 @@ function M.diagnostics_loclist(local_result) v.uri = v.uri or uri end end - vim.lsp.util.set_loclist(util.locations_to_items(local_result)) + if #vim.fn.getloclist(vim.fn.winnr()) == 0 then + vim.lsp.util.set_loclist(util.locations_to_items(local_result)) + end end function M.publish_diagnostics(bufnr)