Skip to content

fix(tui): highlight shell script files - #44772

Merged
kitlangton merged 1 commit into
v2from
fix-shell-highlight
Aug 24, 2026
Merged

kitlangton merged 1 commit into
v2from
fix-shell-highlight

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Restore syntax highlighting for shell script files across V2 TUI code renderers, including session tool cards and the standalone diff viewer.

Before / After

Before: .sh, .bash, .zsh, and .ksh paths resolved to shellscript, but the bundled Tree-sitter parser is registered as bash. Any renderer using the shared filetype resolver fell back to plain text for those files.

After: those extensions resolve to the registered bash parser, so existing Bash highlighting applies consistently wherever shell files are rendered.

How

  • Align the shell entries in packages/tui/src/util/filetype.ts with OpenTUI's canonical bash filetype.
  • Add a regression test that checks all four extensions and verifies their result matches a registered parser.

Scope

This does not add or replace a syntax parser. It connects shell file paths to the Tree-sitter Bash parser already shipped in packages/tui/src/parsers-config.ts.

Testing

  • bun run test test/util/filetype.test.ts from packages/tui
  • bun typecheck from packages/tui
  • Full repository typecheck from the push hook: 32 packages passed
  • Direct OpenTUI highlightOnce(..., "bash") runtime probe: 23 highlight spans
  • Matched OpenCode Drive session runs against origin/v2 (71f81dc0fe) and this change (17fafb4c4b)

Demo

Both recordings use the same fixture, viewport, prompt, and simulated model response. The model invokes the real offered patch tool, which produces the session transcript card shown here.

Before (origin/v2): the session tool card renders .sh content as plain text

recording-cee6437d-4f1e-4361-a120-d21897a767df.mp4

After (17fafb4c4b): the same session tool card uses the existing Bash parser

recording-7dd213e6-06ee-4eb3-b550-7e8d1f56b06e.mp4

@kitlangton
kitlangton merged commit 2f740ce into v2 Aug 24, 2026
9 of 15 checks passed
@kitlangton
kitlangton deleted the fix-shell-highlight branch August 24, 2026 21:21
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant