Skip to content

Commit

Permalink
fix: diagnostics sections
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 23, 2023
1 parent ef47f7a commit c787125
Showing 1 changed file with 55 additions and 54 deletions.
109 changes: 55 additions & 54 deletions lua/trouble/sources/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,63 @@ M.highlights = {
M.modes = {
diagnostics = {
events = { "DiagnosticChanged", "BufEnter" },
sections = -- {
-- -- Trouble classic for current buffer
-- source = "diagnostics",
-- groups = {
-- { format = "{hl:Title}Diagnostics (current buffer){hl} {filename} {count}" },
-- },
-- sort = { "severity", "filename", "pos" },
-- format = "{severity_icon} {message} {item.source} ({code}) {pos}",
-- filter = {
-- buf = 0,
-- },
-- },
-- filename group sorted by severity
-- items per filename sorted by pos
{
-- Trouble classic for other buffers,
-- but only if they are in the current directory
source = "diagnostics",
groups = {
{ format = "{hl:Special}蟀殺 {hl} {hl:Title}Diagnostics{hl} {count}" },
{ "severity", format = "{severity_icon} {severity} {count}" },
{ "filename", format = "{file_icon} {filename} {count}" },
},
sort = { { buf = 0 }, "severity", "filename", "pos", "message" },
format = "{severity_icon} {message} {item.source} ({code}) {pos}",
filter = {
-- ["not"] = {
-- any = {
-- { severity = vim.diagnostic.severity.ERROR },
-- { buf = 0 },
-- },
-- },
-- function(item)
-- return item.filename:find(vim.loop.cwd(), 1, true)
-- end,
sections = {
-- -- Trouble classic for current buffer
-- source = "diagnostics",
-- groups = {
-- { format = "{hl:Title}Diagnostics (current buffer){hl} {filename} {count}" },
-- },
-- sort = { "severity", "filename", "pos" },
-- format = "{severity_icon} {message} {item.source} ({code}) {pos}",
-- filter = {
-- buf = 0,
-- },
-- },
-- filename group sorted by severity
-- items per filename sorted by pos
{
-- Trouble classic for other buffers,
-- but only if they are in the current directory
source = "diagnostics",
groups = {
{ format = "{hl:Special}蟀殺 {hl} {hl:Title}Diagnostics{hl} {count}" },
{ "severity", format = "{severity_icon} {severity} {count}" },
{ "filename", format = "{file_icon} {filename} {count}" },
},
sort = { { buf = 0 }, "severity", "filename", "pos", "message" },
format = "{severity_icon} {message} {item.source} ({code}) {pos}",
filter = {
-- ["not"] = {
-- any = {
-- { severity = vim.diagnostic.severity.ERROR },
-- { buf = 0 },
-- },
-- },
-- function(item)
-- return item.filename:find(vim.loop.cwd(), 1, true)
-- end,
},
},
-- {
-- -- error from all files
-- source = "diagnostics",
-- groups = { "severity", "code", "filename" },
-- filter = {
-- -- severity = 1,
-- },
-- sort = { "filename", "pos" },
-- format = "sig {severity_sign} {severity} file: {filename} pos: {pos}",
-- },
-- {
-- -- diagnostics from current buffer
-- source = "diagnostics",
-- groups = { "severity", "filename" },
-- filter = {
-- buf = 0,
-- },
-- sort = { "pos" },
-- },
},
-- {
-- -- error from all files
-- source = "diagnostics",
-- groups = { "severity", "code", "filename" },
-- filter = {
-- -- severity = 1,
-- },
-- sort = { "filename", "pos" },
-- format = "sig {severity_sign} {severity} file: {filename} pos: {pos}",
-- },
-- {
-- -- diagnostics from current buffer
-- source = "diagnostics",
-- groups = { "severity", "filename" },
-- filter = {
-- buf = 0,
-- },
-- sort = { "pos" },
-- },
},
}

Expand Down

0 comments on commit c787125

Please sign in to comment.