1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-13 01:22:20 -05:00

fix(lsp): wasm file import completions (#27018)

This commit is contained in:
Nayeem Rahman 2024-11-23 01:26:30 +00:00 committed by GitHub
parent 9967e75e7e
commit 12b377247b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,16 @@ pub fn is_importable_ext(path: &Path) -> bool {
if let Some(ext) = get_extension(path) {
matches!(
ext.as_str(),
"ts" | "tsx" | "js" | "jsx" | "mjs" | "mts" | "cjs" | "cts" | "json"
"ts"
| "tsx"
| "js"
| "jsx"
| "mjs"
| "mts"
| "cjs"
| "cts"
| "json"
| "wasm"
)
} else {
false
@ -222,6 +231,7 @@ mod test {
assert!(is_script_ext(Path::new("foo.cjs")));
assert!(is_script_ext(Path::new("foo.cts")));
assert!(!is_script_ext(Path::new("foo.json")));
assert!(!is_script_ext(Path::new("foo.wasm")));
assert!(!is_script_ext(Path::new("foo.mjsx")));
}
@ -243,6 +253,7 @@ mod test {
assert!(is_importable_ext(Path::new("foo.cjs")));
assert!(is_importable_ext(Path::new("foo.cts")));
assert!(is_importable_ext(Path::new("foo.json")));
assert!(is_importable_ext(Path::new("foo.wasm")));
assert!(!is_importable_ext(Path::new("foo.mjsx")));
}