Commit 8e02912
authored
Recognize .command files as shell scripts (#9345)
## Description
Fixes #9213. On macOS, `.command` is the standard extension for
double-clickable shell scripts (a `#!/usr/bin/env bash` file you can
`chmod +x` and run from Finder). Opening one in Warp's editor today
shows "Language support is unavailable for this file type" because
`language_by_filename` in `crates/languages/src/lib.rs` doesn't include
`command` next to the existing `sh | zsh | bash` shell extensions.
```diff
- "sh" | "zsh" | "bash" => language_by_name("shell"),
+ "sh" | "zsh" | "bash" | "command" => language_by_name("shell"),
```
## Testing
- Added `command_extension_resolves_to_shell` in
`crates/languages/src/lib_tests.rs` that calls
`language_by_filename(Path::new("script.command"))` and asserts the
returned language's `display_name` is `"Shell"` — fails on master,
passes after the fix.
- `cargo fmt -p languages -- --check` passes locally.
- Couldn't run `cargo nextest run -p languages` locally because the
Metal toolchain isn't installed (same situation as #9277), so relying on
CI for the full clippy / nextest pass.
## Changelog Entries for Stable
CHANGELOG-BUG-FIX: `.command` shell scripts now open with shell syntax
highlighting in Warp's editor.
Co-authored-by: anshul-garg27 <anshul-garg27@users.noreply.github.com>1 parent 38f8d5b commit 8e02912
2 files changed
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
54 | 53 | | |
0 commit comments