Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/languages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn language_by_filename(path: &Path) -> Option<Arc<Language>> {
"ts" | "cts" | "mts" => language_by_name("typescript"),
"java" | "groovy" | "gvy" | "gy" | "gsh" => language_by_name("java"),
"cpp" | "cxx" | "cc" | "h" | "hh" => language_by_name("cpp"),
"sh" | "zsh" | "bash" => language_by_name("shell"),
"sh" | "zsh" | "bash" | "command" => language_by_name("shell"),
"cs" => language_by_name("csharp"),
"html" => language_by_name("html"),
"css" => language_by_name("css"),
Expand Down
15 changes: 14 additions & 1 deletion crates/languages/src/lib_tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::{load_language, SUPPORTED_LANGUAGES};
use std::path::Path;

use crate::{language_by_filename, load_language, SUPPORTED_LANGUAGES};

/// Validate that every supported language can be loaded successfully.
/// This catches invalid node types, syntax errors, and other issues in .scm query files
Expand All @@ -20,3 +22,14 @@ fn all_supported_languages_load_successfully() {
.join("\n")
);
}

/// `.command` is the macOS convention for double-clickable shell scripts.
/// Make sure `language_by_filename` recognizes it as shell so the editor
/// renders syntax highlighting instead of the
/// "Language support is unavailable for this file type" footer.
#[test]
fn command_extension_resolves_to_shell() {
let language = language_by_filename(Path::new("script.command"))
.expect("`.command` files should resolve to a language");
assert_eq!(language.display_name, "Shell");
}
Loading