Skip to content

Commit d2461c5

Browse files
committed
chore(diagnostics): clear whole group instead of keeping a table
1 parent a1600e5 commit d2461c5

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

lua/nvim-tree/diagnostics.lua

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local log = require "nvim-tree.log"
66

77
local M = {}
88

9+
local GROUP = "NvimTreeDiagnosticSigns"
10+
911
local function get_lowest_severity(diagnostics)
1012
local severity = math.huge
1113
for _, v in ipairs(diagnostics) do
@@ -24,15 +26,13 @@ local sign_names = {
2426
{ "NvimTreeSignHint", "NvimTreeLspDiagnosticsHint" },
2527
}
2628

27-
local signs = {}
28-
2929
local function add_sign(linenr, severity)
3030
local buf = view.get_bufnr()
3131
if not a.nvim_buf_is_valid(buf) or not a.nvim_buf_is_loaded(buf) then
3232
return
3333
end
3434
local sign_name = sign_names[severity][1]
35-
table.insert(signs, vim.fn.sign_place(1, "NvimTreeDiagnosticSigns", sign_name, buf, { lnum = linenr + 1 }))
35+
vim.fn.sign_place(1, GROUP, sign_name, buf, { lnum = linenr + 1 })
3636
end
3737

3838
local function from_nvim_lsp()
@@ -109,16 +109,7 @@ function M.clear()
109109
return
110110
end
111111

112-
if #signs then
113-
vim.fn.sign_unplacelist(vim.tbl_map(function(sign)
114-
return {
115-
buffer = view.get_bufnr(),
116-
group = "NvimTreeDiagnosticSigns",
117-
id = sign,
118-
}
119-
end, signs))
120-
signs = {}
121-
end
112+
vim.fn.sign_unplace(GROUP)
122113
end
123114

124115
function M.update()

0 commit comments

Comments
 (0)