[PR #12212] feat(highlight): add javascript and typescript parser for jsx and tsx… #14122

Open
opened 2026-02-16 18:18:56 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12212

State: open
Merged: No


packages/opencode/parser-config.ts

Closes #12211

What does this PR do?

Adds syntax highlighting to jsx and tsx code blocks within markdown by adding JSX and TSX parsers to parser-config.ts.

How did you verify your code works?

Ran bun dev with a session that outputs jsx and tsx code blocks.

Before:
image
image

After:
image
image

Remarks

Remarks:

  • tree-sitter-javascript.wasm seems to be able to handle jsx
  • tree-sitter-typescript highlights seems incomplete
  • Maybe it's better to map tsx and jsx to markdown's infoMapString within @opentui/core.

jsx and tsx files seem to be highlighted when part of Write tool output, so this might be only an issue for markdown-injected jsx and tsx.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12212 **State:** open **Merged:** No --- packages/opencode/parser-config.ts Closes #12211 ### What does this PR do? Adds syntax highlighting to `jsx` and `tsx` code blocks within markdown by adding JSX and TSX parsers to `parser-config.ts`. ### How did you verify your code works? Ran `bun dev` with a session that outputs `jsx` and `tsx` code blocks. Before: <img width="1012" height="727" alt="image" src="https://github.com/user-attachments/assets/20100e81-92b0-488d-be45-baf8616a640c" /> <img width="1010" height="888" alt="image" src="https://github.com/user-attachments/assets/48389998-dcf8-4018-9b97-8af415a5ac7d" /> After: <img width="1020" height="737" alt="image" src="https://github.com/user-attachments/assets/50f169d4-c795-4ac4-9d64-cc7c20f5aae0" /> <img width="1009" height="840" alt="image" src="https://github.com/user-attachments/assets/98e5c00b-8735-4fc7-9d76-8642176daa19" /> ### Remarks Remarks: - tree-sitter-javascript.wasm seems to be able to handle jsx - tree-sitter-typescript highlights seems incomplete - Maybe it's better to map `tsx` and `jsx` to markdown's infoMapString within `@opentui/core`. > `jsx` and `tsx` files seem to be highlighted when part of Write tool output, so this might be only an issue for markdown-injected jsx and tsx.
yindo added the pull-request label 2026-02-16 18:18:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14122