Fix: Add env object syntax to launch.json schema for cppdbg and cppvsdbg - #14691
Prashant Kumar Rai (8prashant) wants to merge 33 commits into
Conversation
|
I don't think we should have two properties that do the same thing (also, this PR does not update the optionsSchema.json which means the next time package.json is generated, this will be deleted). Adding Andrew Wang (@WardenGnaw) for comment. |
|
Thanks for the contribution. This change will work for One issue with this change is that Aside from updating the OptionsSchema.json. There needs to be a change to MIEngine to support this or limit the new schema entry to The other option is to add a cpptools configuration-provider conversion from |
|
Thanks Andrew Wang (WardenGnaw) for the review. I’ve pushed updates to address this by fixing the no-debug path so the inline adapter now merges both environment and env with env taking precedence, adding cppdbg normalization in the configuration provider to convert env to environment so MIEngine receives the format it currently supports, updating OptionsSchema.json so the new env schema entries are preserved during regeneration, and adding Run Without Debugging integration coverage to verify env is applied and correctly overrides duplicate environment entries. I intentionally kept this fix in cpptools rather than making MIEngine changes in this PR because it resolves both normal launch and Run Without Debugging immediately, whereas a MIEngine-only change would not cover no-debug, and this approach avoids cross-repo dependency and release-coordination risk while keeping the change scoped and low risk; native MIEngine env support can still be added later as a separate follow-up enhancement. |
|
Hi Sean McManus (@sean-mcmanus) |
|
Prashant Kumar Rai (@8prashant) Yeah, sorry, I've been busy with other stuff and forgot about these PRs. |
Sean McManus (sean-mcmanus)
left a comment
There was a problem hiding this comment.
Reviewed the current head; see the inline comments.
…nce integration tests for env object handling in cppdbg
…nce integration tests for env object handling in cppdbg
…rashant/vscode-cpptools into fix/12537-env-property-schema
…rashant/vscode-cpptools into fix/12537-env-property-schema
…rashant/vscode-cpptools into fix/12537-env-property-schema
There was a problem hiding this comment.
🔵 Needs a closer look
Terminals without shell integration can be reused while their previous command is still running.
Review details
Suppressed comments (1)
Extension/src/Debugger/runWithoutDebuggingAdapter.ts:170
- In the no-shell-integration fallback,
sendTextonly queues the command, so removing the terminal fromactiveTerminalsimmediately makes it appear reusable while the launched process may still be running. A subsequent launch can then interleave another command in that shell, or dispose the terminal at line 132 when its environment differs, terminating the first process. Since completion cannot be observed on this path, stop managing this terminal for reuse so the next launch creates a separate terminal.
activeTerminals.delete(this.terminal);
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…nals upon termination
There was a problem hiding this comment.
🔵 Needs a closer look
The new macOS external-terminal environment handling lacks automated coverage.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
Extension/src/Debugger/runWithoutDebuggingAdapter.ts:209
- The macOS external-terminal environment path has no automated coverage: the new env integration test always selects an integrated/internal console, and
.github/workflows/job-compile-and-test.yml:143runs this scenario withskipExternalConsole. Please add coverage for this/usr/bin/envcommand construction, especially values requiring shell/AppleScript escaping, so regressions in external launches are caught.
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…rminal command construction
|
Hi Sean McManus (@sean-mcmanus) , Could you please re-review when you have a chance? |
Sean McManus (sean-mcmanus)
left a comment
There was a problem hiding this comment.
Re-reviewed the current head; see the inline comment.
…et and set environment variables, ensuring correct order and improved clarity in command generation.
There was a problem hiding this comment.
🟡 Changes recommended
The parsed-environment interface now permits null values that normal debug adapters and the public schemas do not support.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ing for environment variables in remote and command-driven cppdbg targets
There was a problem hiding this comment.
🔵 Needs a closer look
An in-flight terminal can become reusable after manual session disposal, allowing a subsequent command to target a busy terminal.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
Extension/src/Debugger/runWithoutDebuggingAdapter.ts:409
- If the user stops the no-debug session while its shell command is still running,
dispose()removes the terminal fromactiveTerminalseven thoughterminateProcess()cannot stop a terminal execution. The terminal remains inmanagedTerminals, so the next launch with the same program/environment reuses that busy terminal and may send the new command to the running process instead of its shell. Keep it marked active until the shell execution ends, or remove it from the managed/reusable map when disposing an in-flight session.
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…moved upon shell execution and termination
Problem
#12537 : Using the shorthand
envobject syntax inlaunch.jsonproduces a false validation warning: