Repository navigation
Exclude markup punctuation from rainbow brackets - #94
Open
MartinoPolo wants to merge 1 commit into
Open
MartinoPolo wants to merge 1 commit into
MartinoPolo wants to merge 1 commit into
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @MartinoPolo 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'. |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
`colorize_brackets` colors every pair listed in `brackets.scm` from the
theme's `accents`, by nesting depth. For Svelte that overrode the theme's
`tag.punctuation.bracket` on `<` and `>`, and `string` on attribute quotes.
The result was also inconsistent: `("<" @OPEN ">" @close)` only matches
`<` and `>` as siblings, which happens in a start tag but not in an end
tag (`</` … `>`) or a self-closing tag (`<` … `/>`), so start tags were
rainbow-colored while the tags closing them stayed the theme color.
Mark those pairs `rainbow.exclude`, as the bundled HTML extension already
does. `{}` and `()` keep their rainbow colors, which is where the feature
is actually useful in Svelte markup.
MartinoPolo
force-pushed
the
exclude-markup-punctuation-from-rainbow-brackets
branch
from
August 18, 2026 14:17
aa6997c to
ae5147b
Compare
ghostdevv
requested changes
Aug 18, 2026
ghostdevv
left a comment
Collaborator
There was a problem hiding this comment.
Could you share some before/after screenshots?
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Problem
With
"colorize_brackets": true(rainbow brackets), Zed colors every pair declared inbrackets.scmfrom the theme'saccentsarray, by nesting depth. That overrides the theme's syntax colors for those tokens.In Svelte files this hits the markup punctuation:
<and>are painted fromaccentsinstead of the theme'stag.punctuation.bracketaccentsinstead of the theme'sstring, soclass="foo"shows gold delimiters around a differently-colored bodyIt also renders inconsistently, which is what makes it look like a bug rather than a preference.
("<" @open ">" @close)matches<and>only as siblings, and that only happens in a start tag — an end tag is</…>(no<token) and a self-closing tag is<…/>(no>token). So<div …>is rainbow-colored while the</div>closing it keeps the theme color.Fix
Mark those pairs
rainbow.exclude, which is what the bundled HTML extension already does for its tag punctuation and quotes:{}and()are left rainbow-colored — mustache blocks and expressions are where the feature actually earns its keep in Svelte markup. Bracket matching and thenewline.onlyindent behavior are unchanged;rainbow.excludeonly opts the pair out of colorization.Testing
Applied to the installed extension copy on Zed 1.15 (Windows) with
colorize_brackets: true. Angle brackets and attribute quotes now follow the theme, start and end tags match each other, and{}/()still cycle through the accent colors.