Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

typescript: Fix handling of jest/vitest tests with regex characters in name (#35090)

Piotr Osiewicz57b463fd0df7
diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs
index 34b9c3224ee..fb515448415 100644
--- a/crates/languages/src/typescript.rs
+++ b/crates/languages/src/typescript.rs
@@ -512,7 +512,7 @@ fn eslint_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
fn replace_test_name_parameters(test_name: &str) -> String {
let pattern = regex::Regex::new(r"(%|\$)[0-9a-zA-Z]+").unwrap();
- pattern.replace_all(test_name, "(.+?)").to_string()
+ regex::escape(&pattern.replace_all(test_name, "(.+?)"))
}
pub struct TypeScriptLspAdapter {