diff options
| author | ChristianChiarulli <[email protected]> | 2021-11-07 12:13:45 -0500 | 
|---|---|---|
| committer | ChristianChiarulli <[email protected]> | 2021-11-07 12:13:45 -0500 | 
| commit | 5e9b1c817f68d345f1933b13638b5766709a8b6d (patch) | |
| tree | ffa1a81d25bd88ad0ce1c2e89cceef07d08a2f87 /lua/lvim/lsp | |
| parent | 22095542c29dcb71e2be32c77d9340dfc3e88bb2 (diff) | |
fix: dedupe linting messages
Diffstat (limited to 'lua/lvim/lsp')
| -rw-r--r-- | lua/lvim/lsp/handlers.lua | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index ffb7564a..59f15c1c 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -125,7 +125,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 | 
