Skip to content

Comments

feat: syntax highlighting for TUI code blocks via tree-sitter#353

Merged
bug-ops merged 1 commit intomainfrom
feat/m23/syntax-highlighting
Feb 16, 2026
Merged

feat: syntax highlighting for TUI code blocks via tree-sitter#353
bug-ops merged 1 commit intomainfrom
feat/m23/syntax-highlighting

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 16, 2026

Summary

  • Add tree-sitter-highlight based syntax coloring for fenced code blocks in TUI chat widget
  • Support 6 languages: Rust, Python, JavaScript, JSON, TOML, Bash (with aliases rs/py/js/sh/shell)
  • SyntaxHighlighter singleton via LazyLock with 11 capture categories (keyword, string, comment, function, type, number, operator, variable, attribute, punctuation, constant)
  • Graceful fallback to flat theme.code_block style for unknown languages
  • Migrated zeph-index grammar deps to workspace references (deduplication)

Closes #344, closes #345, closes #346, closes #347

Test plan

  • cargo nextest run -p zeph-tui --lib — 89 tests pass (7 new)
  • cargo nextest run --workspace --lib --bins — 1415 tests pass, 0 regressions
  • cargo clippy -p zeph-tui -- -D warnings clean
  • cargo +nightly fmt --check clean
  • Security audit: cargo-deny clean, no unsafe code
  • Performance: acceptable for MVP, highlight caching deferred
  • Visual verification in TUI with multi-language code blocks

Add tree-sitter-highlight based syntax coloring for fenced code blocks
in the TUI chat widget. Supports Rust, Python, JavaScript, JSON, TOML,
and Bash with language aliases. Falls back to flat style for unknown
languages. SyntaxHighlighter uses LazyLock singleton with 11 capture
categories mapped to SyntaxTheme colors.

Closes #345, closes #346, closes #347
@github-actions github-actions bot added enhancement New feature or request size/L documentation Improvements or additions to documentation rust dependencies and removed enhancement New feature or request size/L labels Feb 16, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 16, 2026 01:16
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 96.00000% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/zeph-tui/src/widgets/chat.rs 81.39% 8 Missing ⚠️
crates/zeph-tui/src/highlight.rs 99.03% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #353      +/-   ##
==========================================
+ Coverage   79.18%   79.33%   +0.14%     
==========================================
  Files          99      100       +1     
  Lines       25428    25665     +237     
==========================================
+ Hits        20136    20361     +225     
- Misses       5292     5304      +12     
Files with missing lines Coverage Δ
crates/zeph-tui/src/lib.rs 0.00% <ø> (ø)
crates/zeph-tui/src/theme.rs 100.00% <ø> (ø)
crates/zeph-tui/src/highlight.rs 99.03% <99.03%> (ø)
crates/zeph-tui/src/widgets/chat.rs 50.98% <81.39%> (+1.39%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bug-ops bug-ops merged commit 09517a4 into main Feb 16, 2026
18 checks passed
@bug-ops bug-ops deleted the feat/m23/syntax-highlighting branch February 16, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation rust

Projects

None yet

2 participants