fix: use LSP-provided project folder for debug sessions - #125
Open
asterite wants to merge 1 commit into
Open
Conversation
The `nargo.debug.dap` and `nargo.debug.test` command handlers were
ignoring the `--program-dir` and `--package` arguments from LSP code
lens. `nargo.debug.dap` delegated to `workbench.action.debug.start`
discarding all args, and `nargo.debug.test` hardcoded
`projectFolder: '${workspaceFolder}'`.
When a Noir project is nested inside the VS Code workspace (e.g.
VS Code opened at `~/workspace` but the project is at
`~/workspace/my-app`), the debugger fails because it can't find
`Nargo.toml` at the workspace root.
Extract `--program-dir` and `--package` from the LSP code lens
arguments and pass them through to the debug launch configuration
for both commands. When `--program-dir` is not provided (e.g. manual
launch), the existing `findNearestPackageFrom` fallback in
`resolveDebugConfiguration` still applies.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Resolved
No issue.
Summary of Changes
When trying to "Debug" via the code lens it only worked if the test to run was in a project that matched the workspace's root. But for example if you open a directory with multiple Noir projects (like Aztec-Packages) and try to debug anything there, it didn't work.
The
nargo.debug.dapandnargo.debug.testcommand handlers were ignoring the--program-dirand--packagearguments from LSP code lens.nargo.debug.dapdelegated toworkbench.action.debug.startdiscarding all args, andnargo.debug.testhardcodedprojectFolder: '${workspaceFolder}'.When a Noir project is nested inside the VS Code workspace (e.g. VS Code opened at
~/workspacebut the project is at~/workspace/my-app), the debugger fails because it can't findNargo.tomlat the workspace root.Extract
--program-dirand--packagefrom the LSP code lens arguments and pass them through to the debug launch configuration for both commands. When--program-diris not provided (e.g. manual launch), the existingfindNearestPackageFromfallback inresolveDebugConfigurationstill applies.PR Checklist
cargo fmton default settings.