From 9fce24467bd621aa38d2a078724379ac942774a4 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sat, 23 Nov 2024 01:26:30 +0000 Subject: [PATCH] fix(lsp): wasm file import completions (#27018) --- cli/util/path.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/util/path.rs b/cli/util/path.rs index 58bed664f9..173f357c08 100644 --- a/cli/util/path.rs +++ b/cli/util/path.rs @@ -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"))); }