feat(statusline): add trouble diagnostic counts to statusline #525
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows you to use trouble diagnostic counts on your status line. This is best used when you are running a filter on trouble diagnostics. For example, I only want to see workspace diagnostics and counts.
This is my first time writing lua code and contributing to a neovim plugin. Please be kind but brutal with feedback so that I can improve my solution and learn.
I duplicated a bunch of code in api.lua from
function M.statusline(opts)
. There is probably a way to share most of that code between it andfunction M.diagnosticsCount(opts)
.I would also eventually like to support trouble as a diagnostic source in lualine. I am not sure how to accomplish this. It is also a little more complicated than the others as you would want to specify the mode and/or filter. If anyone has any ideas on this that would be great.