Skip to content

feat(intellij): color TSRX nesting with Rainbow Brackets - #103

Merged
leonidaz merged 18 commits into
mainfrom
jon/intellij-rainbow-brackets
Sep 16, 2026
Merged

leonidaz merged 18 commits into
mainfrom
jon/intellij-rainbow-brackets

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds optional Rainbow Brackets coloring for TSRX JavaScript delimiters, JSX tags and fragments, embedded expressions, dynamic tags, and @{} blocks. Builds on the highlighting fixes merged in #101 and now targets main.

The integration uses TextMate scopes and the standard Rainbow Brackets plugin's theme keys and settings. Rainbow remains optional and its classes/JAR are not bundled into the TSRX plugin.

Correctness and compatibility

  • Preserves outer tags when attributes contain nested JSX, including paired and self-closing tags.
  • Keeps JSX tag nesting independent of JavaScript delimiter nesting. Per-family cycles restart across different bracket families or embedded-expression boundaries, matching the tested native TSX behavior.
  • Compares actual Rainbow color keys between paired TSX/TSRX examples in both cycling modes. TSRX additionally colors fragment punctuation, which the tested native plugin leaves uncolored.
  • Retains malformed-input recovery, cancellation checks, and linear structural analysis.
  • Supports the standard Rainbow Brackets plugin, tested with version 2025.3.12 on WebStorm 2025.2.4. Rainbow Brackets Lite is outside this integration.

Validation

  • 58 Kotlin platform tests passed, including native TSX comparisons and nested-attribute regressions.
  • 40 focused JavaScript grammar and IntelliJ package tests passed.
  • Plugin configuration, build, structure, and WebStorm compatibility verification passed.
  • Changeset/version checks, focused Markdown formatting, and diff checks passed.

The hands-on IDE smoke test for installed/absent companion-plugin states and interactive editing has not been run; the procedure is documented in packages/intellij-plugin/DEVELOPMENT.md.

Related: #100.


Note

Medium Risk
New editor highlighting path with non-trivial structural parsing, but it is optional, fails closed without Rainbow, and is heavily covered by platform tests; risk is mainly regressions in IDE performance or highlight correctness on large files.

Overview
Adds optional structural bracket coloring for .tsrx when the standard Rainbow Brackets plugin (2025.3.12) is installed. The TSRX ZIP declares that plugin as an optional dependency and loads a companion descriptor that registers TsrxRainbowBracketsHighlightVisitor; Rainbow’s JAR and classes are not bundled.

A TextMate-lexer-driven analyzer pairs JS/TS delimiters, @{} template blocks, JSX tags (including nested-in-attribute and dynamic tags), fragments, and embedded expressions, then assigns nesting levels to match native TSX cycling (mixed-family vs per-family) while reusing Rainbow’s settings and color keys via a guarded adapter. Invalid or crossing structures are dropped; baseline TextMate highlighting remains when Rainbow is absent.

Gradle pulls Rainbow only for dev/test sandboxes; tests cover analyzer behavior, visitor eligibility, TSX color-key parity, packaging, and docs/smoke steps in DEVELOPMENT.md and README.md.

Reviewed by Cursor Bugbot for commit 33c353e. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tsrx-website Ready Ready Preview Sep 16, 2026 6:07pm UTC
tsrx-website-mcp Ready Ready Preview Sep 16, 2026 6:07pm UTC

Request Review

@jonkwheeler jonkwheeler changed the title jon/intellij rainbow brackets feat(intellij): color TSRX nesting with Rainbow Brackets Sep 12, 2026
@leonidaz
leonidaz merged commit 984fd22 into main Sep 16, 2026
12 checks passed
@leonidaz
leonidaz deleted the jon/intellij-rainbow-brackets branch September 16, 2026 18:10
@github-actions github-actions Bot mentioned this pull request Sep 16, 2026

This branch was successfully deployed

2 active deployments
Preview – tsrx-website — 33c353e4 Deployed Sep 16, 2026 by vercel[bot]
Preview – tsrx-website-mcp — 33c353e4 Deployed Sep 16, 2026 by vercel[bot]
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.

2 participants