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

refactor(statusline): add hint and info for non-workspace diagnostics #13257

Closed

Conversation

RoloEdits
Copy link
Contributor

@RoloEdits RoloEdits commented Apr 3, 2025

This adds info and hint diagnostics indicators to the existing warning and error. Besides having more info for the current code you are looking at, this also opens up changing the fallback accumulator being to hint now, instead of error. In cases where LSPs improperly handle diagnostic level declaration, this now prevents an error being declared across both the current buffer as well as the workspace (I have removed the fallback accumulator for the workspace). This should hopefully help reduce noise.

image

@RoloEdits RoloEdits force-pushed the hint-info-statusline branch 2 times, most recently from 55a106f to 84ff850 Compare April 3, 2025 04:22
@RoloEdits RoloEdits force-pushed the hint-info-statusline branch from 84ff850 to c1cbf44 Compare April 3, 2025 04:23
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC it's only warnings and errors now so that the component doesn't take up much space. Adding hints + info makes it fairly wide

Comment on lines +237 to +239
Some(Severity::Hint) | None => counts.0 += 1,
Some(Severity::Info) => counts.1 += 1,
Some(Severity::Warning) => counts.2 += 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent we should probably use diag.severity() here so that None becomes Warning -

impl Diagnostic {
#[inline]
pub fn severity(&self) -> Severity {
self.severity.unwrap_or(Severity::Warning)
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason Warning was chosen and not something else like Hint?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure of the context of it. It does make some sense to me that the "default" state of a diagnostic is a warning. I don't think it's very common that language servers omit the severity anyways

@RoloEdits
Copy link
Contributor Author

RoloEdits commented Apr 6, 2025

I wonder if there would be a nice way to have a min severity like how inline diagnostics have? The default would be to keep warning. But then you can change to "hint" or "info" (or even just "error").

[editor.statusline]
min-diagnostic-severity = "hint"

@the-mikedavis
Copy link
Member

Superseded by #13288

@RoloEdits RoloEdits deleted the hint-info-statusline branch April 10, 2025 01:22
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.

None yet

2 participants