Skip to content

Commit 3655e09

Browse files
unhappychoiceclaude
andcommitted
feat: add Svelte syntax highlighting support
Add tree-sitter-svelte-ng dependency and register .svelte extension for syntax highlighting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 44069ae commit 3655e09

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎Cargo.lock‎

Lines changed: 11 additions & 0 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
@@ -63,6 +63,7 @@ tree-sitter-python = "0.25"
6363
tree-sitter-ruby = "0.23"
6464
tree-sitter-rust = "0.24"
6565
tree-sitter-scala = "0.24"
66+
tree-sitter-svelte-ng = "1.0"
6667
tree-sitter-swift = "0.7"
6768
tree-sitter-typescript = "0.23"
6869
tree-sitter-xml = "0.7"

‎src/syntax/languages/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub mod python;
2121
pub mod ruby;
2222
pub mod rust;
2323
pub mod scala;
24+
pub mod svelte;
2425
pub mod swift;
2526
pub mod typescript;
2627
pub mod xml;
@@ -59,6 +60,7 @@ pub fn get_language(path: &Path) -> Option<(Language, &'static str)> {
5960
"rb" | "rbw" | "rake" | "gemspec" => Some((ruby::language(), ruby::HIGHLIGHT_QUERY)),
6061
"rs" => Some((rust::language(), rust::HIGHLIGHT_QUERY)),
6162
"scala" | "sc" | "sbt" => Some((scala::language(), scala::HIGHLIGHT_QUERY)),
63+
"svelte" => Some((svelte::language(), svelte::HIGHLIGHT_QUERY)),
6264
"swift" => Some((swift::language(), swift::HIGHLIGHT_QUERY)),
6365
"ts" | "tsx" | "mts" | "cts" => Some((typescript::language(), typescript::HIGHLIGHT_QUERY)),
6466
"xml" | "svg" | "xsl" | "xslt" => Some((xml::language(), xml::HIGHLIGHT_QUERY)),

‎src/syntax/languages/svelte.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_svelte_ng::LANGUAGE.into()
3+
}
4+
5+
pub const HIGHLIGHT_QUERY: &str = tree_sitter_svelte_ng::HIGHLIGHTS_QUERY;

0 commit comments

Comments
 (0)