Replace syntect defaults with two-face for expanded syntax highlighting#155
Merged
agavra merged 1 commit intoagavra:mainfrom Feb 8, 2026
Merged
Conversation
7de9208 to
2d44a14
Compare
…tax highlighting Switch from syntect's built-in syntax/theme definitions to two-face, which bundles bat's expanded sets (~170 languages). This adds native highlighting for TypeScript, TSX, TOML, Dockerfile, Kotlin, and many others — trimming the fallback extension table down to the few formats two-face doesn't cover (jsx, mjs, handlebars, etc.). Also removes the unused syntect-tui dependency. Co-Authored-By: Claude Opus 4.6 <[email protected]>
2d44a14 to
59edc8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #154.
That PR did a few things: it fixed the diff highlighting to split by old/new side (the old code fed interleaved lines through syntect's stateful parser), added per-line failure isolation so one bad line doesn't kill highlighting for the whole file, and included a block of fallback extension mappings to cover languages syntect doesn't ship with (ts -> js, toml -> yaml, kt -> java, etc.).
The first two changes are good and still in the codebase. But while working on the fallback mappings I realized the root problem wasn't missing mappings, it's that syntect's built-in syntax set only covers 40 languages. Mapping TypeScript to JavaScript isn't proper syntax highlighting
The
two-facecrate bundles the syntax and theme definitions frombat, which gives us ~170 languages natively — TypeScript, TSX, TOML, Dockerfile, Kotlin, Swift, Zig, Svelte, Vue, Elixir, and everything else that was in the fallback table. It returns the same syntect types, so the rest of the highlighting pipeline is untouched.What changed:
SyntaxSet::load_defaults_newlines()->two_face::syntax::extra_newlines()ThemeSet::load_defaults()->two_face::theme::extra()SyntaxHighlighter::new()takesEmbeddedThemeNameinstead of&str(compile-time checked)syntect-tui, which was never imported anywhere and was pulling in an oldratatui 0.28.1The
syntectcrate itself stays — two-face wraps it, it doesn't replace it.Test plan
cargo buildcompiles cleancargo test— all 159 tests pass