Repository navigation
fix(tui): highlight shell script files - #44772
Merged
Merged
Conversation
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
1 task done
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.
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.kshpaths resolved toshellscript, but the bundled Tree-sitter parser is registered asbash. Any renderer using the shared filetype resolver fell back to plain text for those files.After: those extensions resolve to the registered
bashparser, so existing Bash highlighting applies consistently wherever shell files are rendered.How
packages/tui/src/util/filetype.tswith OpenTUI's canonicalbashfiletype.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.tsfrompackages/tuibun typecheckfrompackages/tuihighlightOnce(..., "bash")runtime probe: 23 highlight spansorigin/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
patchtool, which produces the session transcript card shown here.Before (
origin/v2): the session tool card renders.shcontent as plain textrecording-cee6437d-4f1e-4361-a120-d21897a767df.mp4
After (
17fafb4c4b): the same session tool card uses the existing Bash parserrecording-7dd213e6-06ee-4eb3-b550-7e8d1f56b06e.mp4