Skip to content

Commit

Permalink
fix(format): compat old signs
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 31, 2024
1 parent d4de08d commit 0e843ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/trouble/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,16 @@ M.formatters = {
if vim.fn.has("nvim-0.10.0") == 1 then
local config = vim.diagnostic.config() or {}
if config.signs == nil or type(config.signs) == "boolean" then
return { text = name:sub(1, 1), hl = "DiagnosticSign" .. name }
return { text = sign and sign.text or name:sub(1, 1), hl = "DiagnosticSign" .. name }
end
local signs = config.signs or {}
if type(signs) == "function" then
signs = signs(0, 0) --[[@as vim.diagnostic.Opts.Signs]]
end
return { text = signs.text and signs.text[severity] or sign.text or name:sub(1, 1), hl = "DiagnosticSign" .. name }
return {
text = signs.text and signs.text[severity] or sign and sign.text or name:sub(1, 1),
hl = "DiagnosticSign" .. name,
}
else
return sign and { text = sign.text, hl = sign.texthl } or { text = name } or nil
end
Expand Down

0 comments on commit 0e843ed

Please sign in to comment.