-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Adds a diagnostics severity marker to diagnostics picker #5110
Adds a diagnostics severity marker to diagnostics picker #5110
Conversation
helix-term/src/commands/lsp.rs
Outdated
_ => ' ', | ||
}) | ||
.unwrap_or(' '); | ||
format!("{} ", symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little sad we need to allocate all the time for each and every diagnostic.
If Span::raw
accept &'static str
, we could simply embed the space in the returned string and do something like:
// Two characters wide, so two spaces in the default
.map_or(" ", |s| match s {
DiagnosticSeverity::HINT => "H ",
DiagnosticSeverity::INFORMATION => "I ",
DiagnosticSeverity::WARNING => "W ",
DiagnosticSeverity::ERROR => "E ",
_ => " ",
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as not config option is offered for this, it would work well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Span
is a Cow
so it is possible to create one from a &'static str without allocating so I also think we should return a str
and avoid allocation.. Even if this was configurable it should be possible to use a reference to the config here
8bc44b8
to
8e1b780
Compare
FYI, this somewhat overlaps with icon support: #2869 (comment) |
Definitely similar thanks for providing additional context. For people that prefer an icon here I think a simple config option to change the displayed text could be added in the future, although that would disable filtering (there is an option to add different text for filtering then is being displayed but using this for anything but a performance optimization would not only be confusing but also seems to break highlighting of matched incidences). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 I like this change. It's a useful way to filter diagnostics that doesn't impede existing use-cases and integrates well with the picker.
This has been sitting approved for two months now and it's a fairly small change, are there any blockers ? |
There are loads of PRs that sit approved for a while. The review bandwidth of @archseer and @the-mikedavis is limited. We recive and merge a huge number of PRs. Eventually this PR will be reviewed by them. |
8e1b780
to
db29152
Compare
db29152
to
2f2e6cb
Compare
Co-authored-by: Poliorcetics <[email protected]>
2f2e6cb
to
e7ef955
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we want this and similar info (for example symbol kind in the symbol picker) in the pickers but just concatenating it into the row seems like a bandaid to me. I'd rather see the picker organized as a table so this info can be a column - it's included in the linked table picker PR.
Closing in favor of #7265 |
Diagnostics severity markers
E
,W
,I
,H
in diagnostics picker.As noted in the related issue comments, this allows filtering inside the picker by these markers.
This is also useful for people who have color blindness.
I was trying different formats and styles. Format like
[E]
looks heavy and takes up a precious space. Styling markers with diagnostics color looks a little weird, especially with a file path in workspace diagnostics picker. In any case I'm open to any suggestions.Closes #3543