Skip to content

feat: distinct inline diagnostic theme keys #13318

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Regaez
Copy link

@Regaez Regaez commented Apr 10, 2025

What

Adds more specific theme keys to target the inline diagnostic styles:

  • hint.diagnostic.inline
  • info.diagnostic.inline
  • warning.diagnostic.inline
  • error.diagnostic.inline

The diagnostic-specific keys are appended to the existing "severity" keys so that it is backwards compatible with all existing themes; they will automatically fallback to use the current styles. Suggestions for alternative theme keys are welcome.

Why

I'm loving the recent addition of the inline diagnostic feature, however, sometimes I have been finding the error messages quite distracting as my helix theme uses quite a lot of red. I'd like to be able to style these so that they are less intrusive and make it easier to read the actual code.

Default

# Theme
"error" = { fg = "red" }

Screenshot 2025-04-10 at 09 20 41

With modified error theme key

While one could simply style the error key in the theme, this has the downside of affecting other parts of the UI (such as the gutter icon and the diagnostic picker). For example, I'd like to dim the text of the inline diagnostic but not dim the gutter icon.

# Theme
"error" = { fg = "red", modifiers = ["italic", "dim"] }

Screenshot 2025-04-10 at 09 24 40

With proposed changes

With the proposed changes, one can now apply distinct styles to just the inline diagnostics without affecting other parts of the UI and can read the code more easily (note, non-dimmed gutter icon):

# Theme
"error" = { fg = "red" }
"error.diagnostic.inline" = { fg = "red", modifiers = ["italic", "dim"] }

Screenshot 2025-04-10 at 09 21 08

TODO

If this change is deemed acceptable, I will update this PR to:

  • include documentation of the new theme keys.

@poliorcetics
Copy link
Contributor

This is a backward compatible change, that's nice :)

include documentation of the new theme keys

You should do it already, that way the PR only needs one round of review (hopefully)

@Regaez Regaez force-pushed the inline-diagnostic-styles branch from d6f93b2 to 64bfb6c Compare April 14, 2025 07:49
@carrascomj
Copy link

This closes #11864.

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.

3 participants