Skip to content

feat(highlight): color diff, Kotlin, Dart and SQL code blocks - #1153

Draft
shivamhwp wants to merge 2 commits into
software-mansion:mainfrom
shivamhwp:fix/code-highlight-upstream
Draft

shivamhwp wants to merge 2 commits into
software-mansion:mainfrom
shivamhwp:fix/code-highlight-upstream

Conversation

@shivamhwp

@shivamhwp shivamhwp commented Nov 10, 2026 •

Copy link
Copy Markdown

Fenced diff blocks currently have no highlighting, and Kotlin, Dart and SQL have no compiled grammar option. Add bounded diff-line highlighting and opt-in pinned grammars for those languages, with inserted/deleted token colors across the native renderers. Existing code-block layout, selection, copy and wrapping remain in their native containers.

The shared C++ regression suite covers aliases, Unicode offsets, diff headers and hunks, size limits, and the new languages. The final focused run on the archive source passed 10 cases and 579 assertions; the new keyword/function assertions failed before their fix. Android verification is complete in the T3 Code consumer at d973d8f2fd845d23925e68589a5aaf8878796496, using archive source 23ce6af473d93ce8fc66fb760d447c36a11ba18e. A physical POCO F4 on Android 14 shows diff, Kotlin, Swift, Dart and SQL colors in both themes. Wrap and Copy work, ordinary Markdown selection still works, and a free Replay turn streams and finishes. Before/after captures, recordings and test output include the exact build provenance. The upstream and archive changes have matching stable patch IDs.

The consumer opts into Swift plus the three new grammars. Its ARM64 debug APK grew by 9.97 MiB. Release size and iOS runtime remain unverified. SQL strings can still receive the number color because existing query predicates are not evaluated. Android code-block long press retains Copy menus; it did not provide selection handles before this change. Streaming verification is a smoke pass, not continuous observation of an open fence.

Swift already has an opt-in grammar. This change leaves the default grammar set unchanged. Query predicates remain unsupported; Dart's predicate-dependent identifier heuristics are skipped so structural function/type captures retain their colors.

The docs and CI runs at c97d4734f039b4af30ffdfa20ac18684000c2cdb require upstream maintainer approval before jobs can start. Both runs contain zero jobs; this account has read-only repository permissions.

Refs pingdotgg/t3code#33638.

Implemented by Claude Opus 5.5 in Claude Code; investigated and reviewed by GPT-6.1 Sol in Codex.

shivamhwp and others added 2 commits November 10, 2026 02:39
Fenced diff, Kotlin, Dart and SQL blocks rendered as plain text: no grammar
covered them, and Swift only by opt-in.

Diffs are line-oriented, so the shared seam classifies them line by line
instead of with a grammar: added and removed lines get two new token types,
inserted and deleted, hunk ranges the function color and file headers the
constant color. Inside a hunk whose header gives line counts, "--- x" and
"+++ x" are changed lines, not headers. The existing size caps apply.

Kotlin (tree-sitter-kotlin 0.3.8), Dart (tree-sitter-dart 1.0.0) and SQL
(@derekstride/tree-sitter-sql 0.3.11) join the opt-in grammar tier, with
kt/kts and mysql/postgres/postgresql/pgsql/sqlite aliases and diff/patch
fences. Host doctest coverage for the seam lands in packages/core/cpp/tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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