Skip to content

Conversation

@kubkon
Copy link
Contributor

@kubkon kubkon commented Sep 16, 2025

A couple of notable changes that will land as part of this PR:

  • bump extension api to 0.7.0, so that we can actually use DAP locator API and have fixed std::env::current_dir() handling on Windows host
  • implement all relevant DAP hooks in the Extension trait, and in particular dap_locator_create_scenario and run_dap_locator
  • add two simple tasks that allow the user to invoke zig build run and zig build test directly from the command palette
  • finally implement auto-conversion of zig build run and zig test --test-filter into a debug scenario both of which can be triggered at the GUI level via run/debug markers

This final step comes with a caveat for zig build run, namely, it assumes the project has been created with zig init and the project name matches the executable name. I think this is a fair assumption. In other cases, for more elaborate/custom projects I think it is reasonable to expect the user to create a custom debug config.

TODO:

@kubkon kubkon requested a review from osiewicz September 16, 2025 20:26
@cla-bot cla-bot bot added the cla-signed label Sep 16, 2025
@kubkon kubkon marked this pull request as draft September 17, 2025 10:50
@kubkon kubkon mentioned this pull request Sep 17, 2025
kubkon added a commit that referenced this pull request Sep 17, 2025
Extracted from #10 

Implements custom tasks:
* `zig build test`
* `zig build run`
* `zig test $ZED_FILE --test-filter $ZED_CUSTOM_ZIG_TEST_NAME` - which
runs during runnable code detection
@kubkon kubkon changed the title Add draft dap locator that will auto-convert zig build into debug session Add DAP locator that will auto-convert zig build into debug session Sep 17, 2025
@kubkon kubkon marked this pull request as ready for review September 17, 2025 21:40
.and_then(|cwd| Some(Path::new(&cwd).file_name()?.to_string_lossy().into_owned()))
}

fn get_test_exe_path() -> Option<String> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trip over itself the moment somebody runs two tests (possibly in unrelated projects) concurrently. :/ Could we include some kind of disambiguator here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good catch. Originally I wanted to use project name but CWD is not set at this point. However, thinking about it some more, maybe use UUID that will persist for the duration of this debugging session or something? Kinda feels like reimplementing compiler's caching logic...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osiewicz addressed in 6ef6332

@kubkon kubkon merged commit 0b8f533 into main Sep 23, 2025
1 check passed
@kubkon kubkon deleted the better-dap-config branch September 23, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants