Skip to content

Add TSRX syntax highlighting - #1

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/add-tsrx-highlighting
Jul 26, 2026
Merged

Add TSRX syntax highlighting#1
tannerlinsley merged 1 commit into
mainfrom
taren/add-tsrx-highlighting

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Jul 26, 2026

Copy link
Copy Markdown
Member

Adds dedicated TSRX/Octane language support instead of falling back to plaintext.

Changes

  • Recognizes tsrx with the octane alias
  • Highlights TypeScript/JSX plus Octane @{} component bodies and template directives
  • Supports line-start markup inside Octane component bodies
  • Adds modular exports, docs, real TanStack fixture coverage, and regression tests

Validation

  • Typecheck and build
  • 48 tests across 7 files
  • Docs, skills, package exports, and publint checks
  • All bundle-size budgets
  • Benchmark target: 10,020 blocks at 45.12 blocks/ms

Summary by CodeRabbit

  • New Features

    • Added TSRX language support, including the octane alias.
    • Added syntax highlighting for TSRX component shorthand and template directives.
    • TSRX is now available through language registration, normalization, listing, and highlighting APIs.
  • Documentation

    • Updated language support guides, examples, and reference tables to include TSRX.
  • Bug Fixes

    • Improved JSX detection and highlighting when syntax begins at the start of a line or appears inside template interpolations.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the tsrx language with Octane alias support, TSRX-specific directive and shorthand highlighting, improved JSX-at-line-start detection, highlighter registration, tests, and documentation updates.

Changes

TSRX language implementation

Layer / File(s) Summary
TSRX tokenization and JSX detection
src/internal/script.ts, src/languages/tsrx.ts
Adds TSRX directive and @{ shorthand tokenization, with line-start JSX detection propagated through script and template ranges.
Registration and behavioral validation
src/index.ts, src/languages/index.ts, scripts/*, test/*
Registers tsrx and the octane alias, updates package checks, and tests normalization, tokenization, and context handling.
Language catalog and usage documentation
README.md, docs/*, skills/*
Documents the TSRX export, alias, language support, shared highlighter configuration, and updated language count.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant createHighlighter
  participant tsrx
  participant collectScriptRanges
  participant Tests
  Tests->>createHighlighter: Register tsrx
  createHighlighter->>tsrx: Tokenize source
  tsrx->>collectScriptRanges: Collect script and JSX ranges
  collectScriptRanges-->>tsrx: Return token ranges
  tsrx-->>createHighlighter: Add TSRX keyword ranges
  createHighlighter-->>Tests: Return highlighted tokens
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding TSRX syntax highlighting.
Description check ✅ Passed The description matches the required template and includes both Changes and Validation with concrete details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/add-tsrx-highlighting

Comment @coderabbitai help to get the list of available commands.

@tannerlinsley
tannerlinsley marked this pull request as ready for review July 26, 2026 16:14
@tannerlinsley
tannerlinsley merged commit ce2b104 into main Jul 26, 2026
5 of 6 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/regressions.test.ts (1)

155-170: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover line-start JSX-looking lexical content.

Add multiline template-string and block-comment cases where <Tag /> starts a physical line; this directly exercises jsxAtLineStart and ensures lexical ranges still win over JSX tags.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/regressions.test.ts` around lines 155 - 170, Add multiline
template-string and block-comment cases to the regression test covering `<Tag
/>` at physical line start, asserting it remains lexical content rather than
being tokenized as JSX. Ensure the cases exercise `jsxAtLineStart`, preserve
lexical-range precedence, and continue verifying reconstructed output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/regressions.test.ts`:
- Around line 155-170: Add multiline template-string and block-comment cases to
the regression test covering `<Tag />` at physical line start, asserting it
remains lexical content rather than being tokenized as JSX. Ensure the cases
exercise `jsxAtLineStart`, preserve lexical-range precedence, and continue
verifying reconstructed output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fed2106b-fe9c-4abf-b638-4441f864ea9c

📥 Commits

Reviewing files that changed from the base of the PR and between d6b4904 and ce2b104.

⛔ Files ignored due to path filters (1)
  • test/generated/tanstack-doc-fixtures.json is excluded by !**/generated/**
📒 Files selected for processing (15)
  • README.md
  • docs/guides/octane.md
  • docs/language-support.md
  • docs/reference/languages.md
  • scripts/language-utils.mjs
  • scripts/test-package.mjs
  • skills/_artifacts/domain_map.yaml
  • skills/configure-selective-highlighting/references/languages.md
  • src/index.ts
  • src/internal/script.ts
  • src/languages/index.ts
  • src/languages/tsrx.ts
  • test/fixtures.ts
  • test/modular.test.ts
  • test/regressions.test.ts

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.

1 participant