-
Have tried a few things, but not having any luck, can't find any examples on how to do it, just want the number of errors / warnings (perhaps even todos) for the whole workspace instead of just for the current buffer. (am using nvim lazy distro). return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
-- This doesnt seem to work even though it should
local s = opts.sections.lualine_c[1]
s.sources = { "nvim_workspace_diagnostic" }
opts.sections.lualine_c[1] = s
-- This doesnt work since i dont know the format to use
-- + i dont know how to avoid the existing trouble.statusline from showing up
-- local trouble = require("trouble")
-- local symbols = trouble.statusline({
-- mode = "diagnostics",
-- groups = {},
-- title = false,
-- filter = { range = true },
-- format = "potato",
-- -- format = "{kind_icon}{symbol.name:Normal}",
-- hl_group = "lualine_c_normal",
-- params = { sources = { "nvim_workspace_diagnostic" } }, -- this doesnt seem to do anything
-- })
-- table.insert(opts.sections.lualine_c, 1, {
-- symbols.get,
-- cond = symbols.has,
-- })
-- This works, but it doesnt have the nice trouble UI + i dont know how to remove the existing status line
-- vim.list_extend(opts.sections.lualine_b, {
-- { "diagnostics", sources = { "nvim_workspace_diagnostic" } },
-- })
opts.sections.lualine_y = { "encoding" }
opts.sections.lualine_z = { "location", "progress" }
return opts
end,
},
} |
Beta Was this translation helpful? Give feedback.
Answered by
folke
Jan 11, 2025
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
-
folke's answer led me to the solution + this url here: https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/plugins/ui.lua#L93 Working solution: return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
local icons = LazyVim.config.icons
local trouble = require("trouble")
local symbols = trouble.statusline({
mode = "lsp_document_symbols",
groups = {},
title = false,
filter = { range = true },
format = "{kind_icon}{symbol.name:Normal}",
hl_group = "lualine_c_normal",
})
opts.sections.lualine_c = {
LazyVim.lualine.root_dir(),
{
"diagnostics",
sources = { "nvim_workspace_diagnostic" },
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ LazyVim.lualine.pretty_path() },
{
symbols.get,
cond = symbols.has,
},
}
opts.sections.lualine_y = { "encoding" }
opts.sections.lualine_z = { "location", "progress" }
return opts
end,
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The number of diagnostics does not come from trouble, that's a builtin of lualine.
The code context however, IS trouble. Not aerial.