folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.11k stars 173 forks source link

feat: add trouble diagnostic counts to statusline #525

Open spenrose opened 4 days ago

spenrose commented 4 days ago

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 and function 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.