Skip to content

Commit 55a5465

Browse files
feat: add swift support to playground
1 parent 99338d0 commit 55a5465

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/wasm_lang.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub enum WasmLang {
2929
Ruby,
3030
Rust,
3131
Scala,
32+
Swift,
3233
}
3334

3435
use WasmLang::*;
@@ -62,6 +63,7 @@ impl FromStr for WasmLang {
6263
"ruby" => Ruby,
6364
"rust" => Rust,
6465
"scala" => Scala,
66+
"swift" => Swift,
6567
_ => return Err(NotSupport(s.to_string())),
6668
})
6769
}
@@ -122,6 +124,7 @@ macro_rules! execute_lang_method {
122124
W::Ruby => L::Ruby.$method($($pname,)*),
123125
W::Rust => L::Rust.$method($($pname,)*),
124126
W::Scala => L::Scala.$method($($pname,)*),
127+
W::Swift => L::Swift.$method($($pname,)*),
125128
W::TypeScript => L::TypeScript.$method($($pname,)*),
126129
W::Tsx => L::Tsx.$method($($pname,)*),
127130
}
@@ -288,4 +291,4 @@ mod test {
288291
let root = grep.root();
289292
assert!(root.find("Some($A)").is_some());
290293
}
291-
}
294+
}

website/public/tree-sitter-swift.wasm

2.42 MB
Binary file not shown.

website/src/components/lang.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const parserPaths = {
1717
ruby: 'tree-sitter-ruby.wasm',
1818
rust: 'tree-sitter-rust.wasm',
1919
scala: 'tree-sitter-scala.wasm',
20+
swift: 'tree-sitter-swift.wasm',
2021
}
2122

2223
export const languageDisplayNames: Record<SupportedLang, string> = {
@@ -35,6 +36,7 @@ export const languageDisplayNames: Record<SupportedLang, string> = {
3536
ruby: 'Ruby',
3637
rust: 'Rust',
3738
scala: 'Scala',
39+
swift: 'Swift',
3840
}
3941

4042
export async function initializeParser() {
@@ -45,4 +47,4 @@ export async function initializeParser() {
4547
export async function setGlobalParser(lang: string) {
4648
const path = parserPaths[lang]
4749
await setupParser(lang, path)
48-
}
50+
}

0 commit comments

Comments
 (0)