feat: add tclsh, wish, and expect shebang detection for Tcl syntax#3647
feat: add tclsh, wish, and expect shebang detection for Tcl syntax#3647mvanhorn wants to merge 4 commits intosharkdp:masterfrom
Conversation
Add first_line_match to the Tcl syntax definition via a patch file, enabling automatic Tcl highlighting for scripts with tclsh, wish, or expect shebangs. Fixes sharkdp#3513
keith-hall
left a comment
There was a problem hiding this comment.
Looks good, thanks. It would be great if we could include some files without extensions, containing those shebang lines, in our "syntax regression tests" to be sure it works as expected and prevent regressions in future. (In particular, it looks like syntect is being improved so we may be able to bump the sublimehq/Packages submodule soon and I want to be sure we keep these improvements working)
CHANGELOG.md
Outdated
|
|
||
| ## Features | ||
|
|
||
| - Add shebang-based detection for Tcl (`tclsh`, `wish`) and Expect (`expect`) scripts, see #3647 (@mvanhorn) |
There was a problem hiding this comment.
I think perhaps this changelog entry could be better suited to the Syntaxes section, what do you think?
…tion Add extensionless regression test files for tclsh, wish, and expect shebangs so syntect bumps don't silently break first-line detection. Move changelog entry from Features to Syntaxes per reviewer suggestion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Added regression test files (extensionless, with tclsh/wish/expect shebangs) and integration tests in 29c913f. This should catch any regressions from syntect bumps. Also moved the changelog entry to the Syntaxes section. |
Generate highlighted test outputs for tclsh, wish, and expect shebang detection files to prevent regressions.
|
Added syntax regression tests for all three shebangs (tclsh, wish, expect) in 0828a97. |
Summary
Adds
first_line_matchto the Tcl sublime-syntax definition so bat automatically detects Tcl scripts by their shebang line (#!/usr/bin/tclsh,#!/usr/bin/wish,#!/usr/bin/expect).Why this matters
bat recognizes
.tclfiles but not Tcl scripts that use shebangs without extensions. Expect scripts (#!/usr/bin/expect) and Wish scripts (#!/usr/bin/wish) are common in automation and GUI tooling but get no syntax highlighting from bat today.Changes
assets/patches/Tcl.sublime-syntax.patch: Addsfirst_line_match: ^\#!.*\b(tclsh|wish|expect)\bto the bundled Tcl syntax definition. The regex matches tclsh, wish, and expect in any shebang path (/usr/bin/,/usr/local/bin/,envwrappers).CHANGELOG.md: Added feature entry.Testing
cargo fmt -- --check: passcargo clippy --locked --all-targets --all-features -- -D warnings: passcargo test --locked: passpatch --strip=0 --dry-run < patches/Tcl.sublime-syntax.patchsucceedsFixes #3513
This contribution was developed with AI assistance (Claude Code).