summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp/handlers.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
commitc9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 (patch)
tree274263ba15e0197180af8bb681e22c4780d5de05 /.config/nvim/lua/lsp/handlers.lua
parente4ea22e223bbd6b4091610c6fa093862cbd32f75 (diff)
Add new lunarvin updates
Diffstat (limited to '.config/nvim/lua/lsp/handlers.lua')
-rw-r--r--.config/nvim/lua/lsp/handlers.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/.config/nvim/lua/lsp/handlers.lua b/.config/nvim/lua/lsp/handlers.lua
index 6801045..01666be 100644
--- a/.config/nvim/lua/lsp/handlers.lua
+++ b/.config/nvim/lua/lsp/handlers.lua
@@ -132,7 +132,18 @@ function M.show_line_diagnostics()
table.sort(diagnostics, function(a, b)
return a.severity < b.severity
end)
- for i, diagnostic in ipairs(diagnostics) do
+
+ local hash = {}
+ local diagnostics_no_dupes = {}
+ for _, v in ipairs(diagnostics) do
+ if not hash[v["message"]] then
+ diagnostics_no_dupes[#diagnostics_no_dupes + 1] = v -- you could print here instead of saving to result table if you wanted
+ hash[v["message"]] = true
+ end
+ end
+ -- print(vim.inspect(diagnostics_no_dupes))
+
+ for i, diagnostic in ipairs(diagnostics_no_dupes) do
local source = diagnostic.source
diag_message = diagnostic.message:gsub("[\n\r]", " ")
if source then