From d7147508e8f9c2e3ecaae9a41f66775faad42695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Koz=C3=A1k?= Date: Wed, 5 Aug 2026 18:42:10 +0200 Subject: [PATCH 1/2] fix: parse the binary path emitted by the test build task `strip_prefix("-femit-bin=")` already returns the bare path, so the following `split("=").nth(1)` only produced a value when the path itself contained a `=`. Everywhere else it returned `None`, so the locator failed with "None of the locators for task `zig test --test-no-exec` completed successfully" and debugging a test was impossible. --- src/zig.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/zig.rs b/src/zig.rs index 76087bf..3a46cf0 100644 --- a/src/zig.rs +++ b/src/zig.rs @@ -266,19 +266,14 @@ impl zed::Extension for ZigExtension { Ok(zed::DebugRequest::Launch(request)) } Some(arg) if arg == "test" => { + // `strip_prefix` already yields the bare path, so the subsequent + // `split("=").nth(1)` was always `None` for paths without a `=`. let program = build_task .args .iter() - .find_map(|arg| { - arg.strip_prefix("-femit-bin=").map(|arg| { - arg.split("=") - .nth(1) - .ok_or("Expected binary path in -femit-bin=") - .map(|path| path.trim_end_matches(".exe")) - }) - }) - .ok_or("Failed to extract binary path from command args") - .flatten()? + .find_map(|arg| arg.strip_prefix("-femit-bin=")) + .ok_or("Failed to extract binary path from command args")? + .trim_end_matches(".exe") .to_string(); let request = zed::LaunchRequest { program, From 8e74235cf3b84cf4237a01b742ac20d92ab1d001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Koz=C3=A1k?= Date: Wed, 5 Aug 2026 18:44:24 +0200 Subject: [PATCH 2/2] fix: strip quotes from the --test-filter argument The build task is spawned directly rather than through a shell, so the quotes wrapping $ZED_CUSTOM_ZIG_TEST_NAME in the zig-test task template end up inside the filter string. `zig test --test-filter "'demo'"` reports "All 0 tests passed", so the debug session launched a binary containing no tests and exited immediately. Each argument is already a single argv element, so no quoting is needed. --- src/zig.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/zig.rs b/src/zig.rs index 3a46cf0..ffa85e6 100644 --- a/src/zig.rs +++ b/src/zig.rs @@ -200,8 +200,10 @@ impl zed::Extension for ZigExtension { let mut args: Vec = build_task .args .into_iter() - // TODO verify if this is required on non-Windows platforms - .map(|s| s.replace("\"", "'")) + // The build task is spawned without a shell, so the quotes around + // $ZED_CUSTOM_ZIG_TEST_NAME reach --test-filter literally and match + // no test at all. Drop them; each arg is already one argv element. + .map(|s| s.replace('"', "")) .collect(); args.push("--test-no-exec".into()); args.push(format!("-femit-bin={test_exe_path}"));