Skip to content

Use supported Zed captures for log levels#18

Merged
MrSubidubi merged 3 commits into
zed-extensions:mainfrom
ayakutt:main
May 14, 2026
Merged

Use supported Zed captures for log levels#18
MrSubidubi merged 3 commits into
zed-extensions:mainfrom
ayakutt:main

Conversation

@ayakutt
Copy link
Copy Markdown
Contributor

@ayakutt ayakutt commented Mar 29, 2026

Summary

This PR fixes #6, where INFO, WARN, and ERROR log levels were not highlighted in some Zed themes such as One Dark.

The root cause was that the extension used these captures in highlights.scm:

  • @info
  • @warning
  • @error

Those are not part of Zed's standard theme-supported syntax captures, so in themes that do not define them explicitly, those tokens fall back to the default foreground color.

Change

This PR updates the log level captures to use supported captures with reliable theme fallbacks:

  • info -> @hint.info
  • warn -> @constant.warning
  • error -> @keyword.error

trace and debug were already using compatible captures and were left unchanged.

Result

INFO, WARN, and ERROR now render with consistent syntax coloring across themes instead of appearing unstyled.

Screenshot 2026-03-17 at 04 05 01

Closes #6

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 29, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @ayakutt on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@ayakutt
Copy link
Copy Markdown
Contributor Author

ayakutt commented Mar 29, 2026

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 29, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @ayakutt on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 29, 2026

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 29, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @ayakutt on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@ayakutt
Copy link
Copy Markdown
Contributor Author

ayakutt commented Apr 2, 2026

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Apr 2, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 2, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Copy Markdown
Contributor

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Thanks for this!

We support more captures these days, thus this is not the optimal approach. Can we instead perhaps add these new captures as fallback captures should the other captures not be set? So keep the current ones and add these as fallbacks only

@ayakutt
Copy link
Copy Markdown
Contributor Author

ayakutt commented Apr 22, 2026

We support more captures these days, thus this is not the optimal approach. Can we instead perhaps add these new captures as fallback captures should the other captures not be set? So keep the current ones and add these as fallbacks only

Thanks for the review @MrSubidubi !

I have a concern about this approach though.

The original issue (#6) is that @info, @warning, and @error are not styled by Zed themes, which is why colors aren't rendering for those log levels. If we keep those as the primary captures and add @hint.info, @constant.warning, @keyword.error as fallbacks, the fallbacks would only be used when the primary captures are not set. Since @info/@warning/@error likely still exist as valid captures (just unstyled), the fallback would never trigger and the issue would persist.

I think replacing them entirely is the right approach here, the original captures simply aren't supported by themes, which is the root cause of the bug.

@MrSubidubi
Copy link
Copy Markdown
Contributor

Nope, see the section on how this applies to themes - if the theme does not specify any highlighting for the primary capture, we will fall back to the secondary one. The only thing here relevant is whether the theme supports that capture and the issue originates from the fact that most themes don't. However, if they do, everything will work as expected. You should also be able to test this locally with the theme you tried this out initially

@ayakutt
Copy link
Copy Markdown
Contributor Author

ayakutt commented May 10, 2026

@MrSubidubi Thanks, that makes sense. I updated the query to keep the original captures as the preferred captures and added the supported captures as fallbacks:

(info) @hint.info @info
(warn) @constant.warning @warning
(error) @keyword.error @error

I also squashed the branch down to a single commit. Could you take another look when you have a chance?

MrSubidubi
MrSubidubi previously approved these changes May 14, 2026
Copy link
Copy Markdown
Contributor

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

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

Awesome, thank you so much! And congratulations to your first contribution! 🎉

@MrSubidubi MrSubidubi enabled auto-merge (squash) May 14, 2026 11:05
pull Bot pushed a commit to Zezo-Ai/zezo-ai that referenced this pull request May 14, 2026
…dustries#56788)

Since we download the grammars into the `./grammars` directory, the
formatting check can fail on unformatted query files that are present in
the grammars directory, as observed in
zed-extensions/log#18

Thus, this PR changes the check to be more specific to just the queries
in the `languages` directory.

Release Notes:

- N/A
@MrSubidubi MrSubidubi merged commit 6d6bb65 into zed-extensions:main May 14, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Colors not rendering for WARN, INFO & ERROR

2 participants