-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change the format in sources/diagnostics.lua #508
Comments
Yiou can just override the format too in your config. opts.modes.diagnostics.format = ... |
Ok, but the current default leaves an empty pair of parentheses "()" if the diagnostic doesn't contain a code, wouldn't it be objectively better to not do that by default and return ""? Plus {pos} also adds the brackets in the formatter and not in the format string, why not do it for each of them so the user can override just the specific formatter instead of the entire string. |
User defined formatter is already implemented in -- Lazy config
{
'folke/trouble.nvim',
opts = {
modes = {
my_diagnostics = {
mode = 'diagnostics',
format = '{my_pos} {my_code}',
},
},
formatters = {
my_pos = function(ctx)
return { text = ctx.item.pos[1] .. ':' .. (ctx.item.pos[2] + 1) },
end,
my_code = function(ctx)
return { text = ctx.item.code and '(' .. ctx.item.code .. ')' or '' },
end,
},
},
} |
I've updated the default format for |
Did you check the docs?
Is your feature request related to a problem? Please describe.
The current format at
trouble.nvim/lua/trouble/sources/diagnostics.lua
Line 29 in e0b35a2
Describe the solution you'd like
Remove the parentheses and change the format to
format = "{severity_icon} {message:md} {item.source} {code} {pos}",
add
to
trouble.nvim/lua/trouble/format.lua
Line 46 in e0b35a2
Additional context
This could probably be done for other formats that contain braces or any other special characters for the sake of more customizability.
(or optionally just make the format itself directly customizable)
The text was updated successfully, but these errors were encountered: