Skip to content

fix(highlighting): restore TypeScript and Markdown syntax styles - #174

Merged
owainlewis merged 1 commit into
mainfrom
codex/issue-162-highlighting
Sep 8, 2026
Merged

fix(highlighting): restore TypeScript and Markdown syntax styles#174
owainlewis merged 1 commit into
mainfrom
codex/issue-162-highlighting

Conversation

@owainlewis

Copy link
Copy Markdown
Owner

Summary

TypeScript and TSX now highlight ordinary JavaScript tokens, with JSX styles taking precedence over general identifiers.
Markdown inline formatting is parsed only in prose and table cells, so emphasis-looking text inside fenced or indented code retains its code style.

Why

TypeScript previously configured only the supplemental grammar query, leaving common tokens uncoloured.
Markdown's extra line-by-line inline pass reinterpreted source inside fences and could not retain multiline emphasis context.
Use complete language query composition and block-owned Markdown injections, removing the redundant parser pass.

Test plan

  • Reproduced missing TypeScript keyword colours, Markdown fence overrides, and table-cell formatting loss with failing regressions before their fixes.
  • All 52 highlighter tests and 57 renderer tests pass, including exact token categories, multiline emphasis, quoted/tilde fences, table cells, unknown-language code, and the retained renderer's string style.
  • cargo fmt --check, git diff --check, cargo clippy --all-targets -- -D warnings, and cargo build --release pass.
  • Release binary PTY smoke passed for .ts, .tsx, and .md: truecolor/string styles, edit/undo, clean exit, preserved files, restored terminal settings, and a usable shell.
  • cargo test passed its unit-test phase. A serial terminal-suite rerun passed 8/10 tests; the two existing redirected-input cases still fail in this local environment (one explicit EPERM). Verify and document the complete local coding workflow #172 tracks investigation. Required CI must pass before merge.
  • Independent review: Approve after fixing the reviewer's Markdown table finding.

Risks

Markdown's block query now explicitly includes child text in inline/code injections and includes table-cell nodes.
The supported-language list, cache strategy, buffer edits, and save behavior are unchanged.
The parent rollout's roadmap state is updated for the already merged direction decision.

Related issue

Closes #162.
Parent: #160.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR restores complete TypeScript and TSX highlighting by composing the JavaScript, JSX, and TypeScript queries, and replaces Markdown’s line-by-line inline highlighting pass with block-owned injections that preserve code-block styling and multiline prose context.

  • Adds focused regressions for TypeScript tokens, TSX precedence, Markdown fences, indented code, multiline emphasis, and table cells.
  • Adds a renderer-level assertion that fenced source retains its language-specific style.
  • Updates the issue plan and roadmap state.

Confidence Score: 5/5

The current PR appears safe to merge, with no actionable correctness, security, or repository-rule violations identified.

The composed language queries restore ordinary TypeScript and TSX categories, while Markdown injections preserve block ownership and avoid interpreting fenced or indented code as prose; focused highlighter and renderer regressions cover the affected behavior.

Important Files Changed

Filename Overview
src/highlighter.rs Composes complete TypeScript/TSX highlight queries, moves Markdown inline handling into block-scoped injections, and adds focused regression coverage.
src/renderer.rs Adds a retained-frame regression test proving that Markdown-fenced Rust strings keep their rendered string style.
docs/issues/162-plan.md Documents the highlighting failure modes, implementation approach, scope, and verification criteria.
docs/roadmap.md Updates roadmap status and records the disposition of superseded layout tickets.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Document and file extension] --> B{Language}
    B -->|TypeScript| C[JavaScript query]
    C --> D[TypeScript supplemental query]
    B -->|TSX| E[JavaScript query]
    E --> F[JSX query]
    F --> G[TypeScript supplemental query]
    B -->|Markdown| H[Markdown block parser]
    H --> I[Inject markdown_inline into prose and table cells]
    H --> J[Inject fenced language into code content]
    D --> K[Highlight spans]
    G --> K
    I --> K
    J --> K
    K --> L[Renderer styles]
Loading

Reviews (2): Last reviewed commit: "fix(highlighting): restore TypeScript an..." | Re-trigger Greptile

@owainlewis
owainlewis force-pushed the codex/issue-162-highlighting branch from cd66d0f to 2f87670 Compare September 8, 2026 16:49
@owainlewis
owainlewis merged commit 886c7ac into main Sep 8, 2026
2 checks passed
@owainlewis
owainlewis deleted the codex/issue-162-highlighting branch September 8, 2026 16:53
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.

Correct TypeScript and fenced Markdown syntax highlighting

1 participant