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

Commit

Permalink
fix: not properly fix the overwriting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
haorenW1025 committed Sep 15, 2020
1 parent 62d658d commit b61d28a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function M.publish_diagnostics(bufnr)
local diagnostics = vim.lsp.util.diagnostics_by_buf[bufnr]
if diagnostics == nil then return end
util.align_diagnostic_indices(diagnostics)
vim.fn.setloclist(0, {}, 'r')
if vim.api.nvim_get_var('diagnostic_enable_underline') == 1 then
vim.lsp.util.buf_diagnostics_underline(bufnr, diagnostics)
end
Expand All @@ -87,7 +86,10 @@ 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
M.diagnostics_loclist(diagnostics)
if #vim.fn.getloclist(vim.fn.winnr()) == 0 then
vim.fn.setloclist(0, {}, 'r')
M.diagnostics_loclist(diagnostics)
end
M.trigger_diagnostics_changed()
end

Expand Down

0 comments on commit b61d28a

Please sign in to comment.