Use supported Zed captures for log levels#18
Conversation
|
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 check |
|
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'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
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 check |
|
The cla-bot has been summoned, and re-checked this pull request! |
MrSubidubi
left a comment
There was a problem hiding this comment.
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
Thanks for the review @MrSubidubi ! I have a concern about this approach though. The original issue (#6) is that 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. |
|
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 |
|
@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 I also squashed the branch down to a single commit. Could you take another look when you have a chance? |
…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
Summary
This PR fixes #6, where
INFO,WARN, andERRORlog 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@errorThose 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.infowarn->@constant.warningerror->@keyword.errortraceanddebugwere already using compatible captures and were left unchanged.Result
INFO,WARN, andERRORnow render with consistent syntax coloring across themes instead of appearing unstyled.Closes #6