Skip to content

feat(tui): add tree-sitter-diff parser for diff syntax highlighting#23059

Open
sant0s12 wants to merge 1 commit intoanomalyco:devfrom
sant0s12:feat/add-tree-sitter-diff-parser
Open

feat(tui): add tree-sitter-diff parser for diff syntax highlighting#23059
sant0s12 wants to merge 1 commit intoanomalyco:devfrom
sant0s12:feat/add-tree-sitter-diff-parser

Conversation

@sant0s12
Copy link
Copy Markdown

@sant0s12 sant0s12 commented Apr 17, 2026

Fenced code blocks with language diff were not syntax-highlighted because no tree-sitter-diff parser was registered. The theme already maps @diff.plus and @diff.minus to green/red colors, so only the parser entry was missing.

Closes #6831

Issue for this PR

Closes #6831

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fenced ```diff code blocks rendered as plain unstyled text because no tree-sitter-diff parser was registered in parsers-config.ts. The theme in theme.tsx already maps diff.plus → green and diff.minus → red via getSyntaxRules(), so the only missing piece was the parser itself.

This PR adds a single entry to parsers-config.ts:

  • WASM grammar: tree-sitter-grammars/tree-sitter-diff v0.1.0
  • Highlight queries: from the same repo's main branch

The entry follows the exact same pattern as every other parser in the file (e.g. bash, toml, hcl). No other files were changed.

How did you verify your code works?

  • Built from source (bun run build in packages/opencode) — build succeeded, smoke test passed
  • Typecheck passed across all 13 packages via turbo typecheck
  • Verified the WASM binary is downloadable from the release URL
  • Verified the highlight queries are valid and use capture names (@diff.plus, @diff.minus, @attribute, etc.) that are already mapped in the theme

Screenshots / recordings

Screenshot 2026-04-17 104304

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Fenced code blocks with language `diff` were not syntax-highlighted
because no tree-sitter-diff parser was registered. The theme already
maps @diff.plus and @diff.minus to green/red colors, so only the
parser entry was missing.

Closes anomalyco#6831
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.

How to get diff colors in custom tool output

1 participant