Skip to content

Commit f309314

Browse files
feat: add Astro syntax highlighting support (#190)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 15be1b8 commit f309314

5 files changed

Lines changed: 26 additions & 7 deletions

File tree

‎Cargo.lock‎

Lines changed: 17 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ streaming-iterator = "0.1"
4040
toml = "1.1"
4141
toml_edit = "0.25"
4242
tree-sitter = "0.25"
43+
tree-sitter-astro-next = "0.1"
4344
tree-sitter-bash = "0.25"
4445
tree-sitter-c = "0.24"
4546
tree-sitter-c-sharp = "0.23"

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ See the [Configuration Guide](docs/configuration.md) for full options and exampl
180180

181181
## Supported Languages
182182

183-
Bash, C, C#, C++, Clojure, CSS, Dart, Elixir, Erlang, Go, Haskell, HTML, Java, JavaScript, JSON, Kotlin, Lua, Markdown, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, XML, YAML, Zig
183+
Astro, Bash, C, C#, C++, Clojure, CSS, Dart, Elixir, Erlang, Go, Haskell, HTML, Java, JavaScript, JSON, Kotlin, Lua, Markdown, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, XML, YAML, Zig
184184

185185
## Documentation
186186

‎src/syntax/languages/astro.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub fn language() -> tree_sitter::Language {
2+
tree_sitter_astro_next::LANGUAGE.into()
3+
}
4+
5+
pub const HIGHLIGHT_QUERY: &str = tree_sitter_astro_next::HIGHLIGHTS_QUERY;

‎src/syntax/languages/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pub mod astro;
12
pub mod bash;
23
pub mod c;
34
pub mod clojure;
@@ -35,6 +36,7 @@ pub fn get_language(path: &Path) -> Option<(Language, &'static str)> {
3536
let extension = path.extension()?.to_str()?;
3637

3738
match extension {
39+
"astro" => Some((astro::language(), astro::HIGHLIGHT_QUERY)),
3840
"sh" | "bash" | "zsh" => Some((bash::language(), bash::HIGHLIGHT_QUERY)),
3941
// C++ before C to handle .h files (can be either)
4042
"cpp" | "cc" | "cxx" | "c++" | "C" | "CPP" | "hpp" | "hh" | "hxx" | "h++" | "H" | "HPP"

0 commit comments

Comments
 (0)