[X] This feature isn't just a vague idea and can have a good practical solution.
[X] I'm completely sure that this feature fits into this plugin.
[X] I'm willing to implement this through a PR.
Problem
I'm using winbar to work with multiple windows. I want to able to see if a certain file has errors at a glance.
Solution Suggestion
Since we have a show_modified option, I think it's also good to have show_diagnostics option.
Workaround
Using the custom_section to show a text or symbol when there are diagnostics error:
-- winbar plugin
return {
"utilyre/barbecue.nvim",
name = "barbecue",
version = "*",
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons", -- optional dependency
},
config = function()
local function has_diagnostics(buf)
local severties = { "error", "warning" }
for _, sev in ipairs(severties) do
local n = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity[string.upper(sev)] })
if n > 0 then
return true
end
end
return false
end
require("barbecue").setup({
custom_section = function(bfnr, _)
local custom = ""
if has_diagnostics(bfnr) then
custom = " " .. custom
end
return custom
end,
})
end,
}
Requirements
Problem
I'm using winbar to work with multiple windows. I want to able to see if a certain file has errors at a glance.
Solution Suggestion
Since we have a
show_modified
option, I think it's also good to haveshow_diagnostics
option.Workaround
Using the
custom_section
to show a text or symbol when there are diagnostics error: