Skip to content
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

displaying diagnostic count on all open buffers in bufferline and for all buffers with diagnostics in the picker in addition with a red highlight #5536

Conversation

bindsdev
Copy link

@bindsdev bindsdev commented Jan 14, 2023

Attempts to close #5519

This PR introduces code that displays the diagnostic count for each open buffer in the buffers section in the bufferline. In addition, it also introduces a count for each of the diagnostic severities in the buffer picker for the buffers with diagnostics. Buffers with diagnostics also have a red highlight in the buffer line and buffer picker.

Tasks

  • Add display for number of diagnostics for each open buffer in the bufferline.

    Example Image:
    image

  • Add display for number of each diagnostic severity for each buffer with diagnostics in the buffer picker.

    Example Image:
    image

  • Add red highlight for buffers with diagnostics in the bufferline.

    Example Image:
    image

  • Add red highlight for each buffer with diagnostics in the buffer picker.

    Example Image:
    image

@LeoniePhiline
Copy link
Contributor

As a user, I would prefer the number of diagnostic types, e.g. "2 errors, 5 warnings", rather than "7 diagnostics".

Otherwise, the naming is weird, since the diagnostics are not what is counted. What is counted is the number of negative results from all diagnostics that have been run.


Side note:

This would be suitable to be solved with icons, see #2869

@bindsdev
Copy link
Author

bindsdev commented Jan 20, 2023

As a user, I would prefer the number of diagnostic types, e.g. "2 errors, 5 warnings", rather than "7 diagnostics".

Otherwise, the naming is weird, since the diagnostics are not what is counted. What is counted is the number of negative results from all diagnostics that have been run.


Side note:

This would be suitable to be solved with icons, see #2869

That is a fair take. It should be fairly easy to implement.

I like the idea of the icons, but in relation to the bufferline, it could get pretty cluttered up there with all the icons and numbers. In that context, I believe that the single number or 9+ would be sufficient. The fact that there is no visible separator that sections off the names of the buffers and anything related to it also doesn't help. Once the design of the bufferline is refined (if that is a discussion), that could be revisited and something similar to bufferline.nvim could result.

But, in the buffer picker, there is sufficient space so it should be fine for the icons and respective numbers to be there without causing clutter.

Once the icon support is added, the code implemented in this PR could be modified to use the icons of course.

@bindsdev
Copy link
Author

I am at a bit of a roadblock with the last task for this PR. I started with directly editing the Component implementation for FilePicker, but any changes made there will apply to every one of the pickers it seems, and this issue is only pertaining to the buffer picker. I am looking for some guidance on how to highlight the buffers with diagnostics red specifically the buffer picker. I assume it might have to be something relating to one of the closures passed to FilePicker::new.

@gabydd
Copy link
Member

gabydd commented Jan 31, 2023

You might want to look at how it's done in #5645

@bindsdev bindsdev changed the title [WIP] displaying diagnostic count on all open buffers in bufferline and for all buffers with diagnostics in the picker in addition with a red highlight displaying diagnostic count on all open buffers in bufferline and for all buffers with diagnostics in the picker in addition with a red highlight Feb 2, 2023
@bindsdev bindsdev marked this pull request as ready for review February 2, 2023 02:50
@bindsdev
Copy link
Author

bindsdev commented Feb 2, 2023

The previous commit implements the red highlight for buffers with diagnostics. It is important to note that this does not work well at all with buffers who have long paths. This seems like something that is covered in #2377. In addition, the text approach can be abandoned when icon support is added (#2869) as mentioned a few messages above.

@pascalkuthe
Copy link
Member

This PR has been stale for over a year. I also don't think we want to focus on the bufferline too much so I don't see us prioritizing this direction. Thanks for contributing

@pascalkuthe pascalkuthe closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

display diagnostic count for all open buffers and all buffers with diagnostics in the picker
4 participants