Implement session state tracking for "Run and Debug" button when Inte… - #14719
Conversation
…lliSense is disabled and add corresponding tests
c556c18 to
47035c5
Compare
There was a problem hiding this comment.
Pull request overview
Ensures Run/Debug editor actions remain available when IntelliSense is disabled.
Changes:
- Tracks active editor changes in the debugger extension.
- Updates build/debug session context keys.
- Adds source, header, non-C/C++, and undefined-editor tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
Extension/src/Debugger/extension.ts |
Adds independent session-state tracking. |
Extension/test/scenarios/SingleRootProject/tests/buildAndDebug.test.ts |
Tests source-file state updates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sean McManus (sean-mcmanus)
left a comment
There was a problem hiding this comment.
Found one session-state lifecycle gap that should be addressed before merging.
… open status and adding tests
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Active-document language-mode changes can leave the Run/Debug context stale.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hi Sean McManus (@sean-mcmanus), |
Sean McManus (sean-mcmanus)
left a comment
There was a problem hiding this comment.
The correctness fixes now look sound. One focused test-coverage gap remains for the new event-driven paths.
|
Prashant Kumar Rai (@8prashant) FYI, the full Run/Debug feature doesn't work since it relies on compiler info that is returned from the cpptools process, but if you have your tasks.json/launch.json already generated (with the IntelliSense engine enabled for example), then it works. |
|
Hi Sean McManus (@sean-mcmanus), thanks for reviewing the PR and for adding the regression coverage. I have confirmed that the requested changes are included, and the latest checks are clean. The PR is approved, but I do not have the merge permission for the upstream repository, so the Merge button is not available to me. Could you please merge PR #14719 when you have a chance? Thanks! |
Fixes #13001
When
C_Cpp.intelliSenseEngineis set to"disabled", the language server client is not started. Previously,cpptools.buildAndDebug.isSourceFileandcpptools.buildAndDebug.isFolderOpencontext keys (which control the visibility of the "Run / Debug C/C++ File" and "Add Debug Configuration" editor action buttons) were only updated within the language server client (client.ts). Consequently, disabling IntelliSense would cause the Run/Debug shortcut buttons to never appear in the editor title bar.This PR updates the Debugger extension initialization (
Debugger/extension.ts) to track active text editor changes and keepbuildAndDebugIsSourceFileandbuildAndDebugIsFolderOpenup to date regardless of whether IntelliSense is enabled or disabled.Changes
updateBuildAndDebugSessionStateand registered anonDidChangeActiveTextEditorlistener inDebuggerExtension.initialize.Extension/test/scenarios/SingleRootProject/tests/buildAndDebug.test.tsverifying session state updates for source files, header files, non-C/C++ files, andundefinededitors.Verification
yarn compile) with 0 errors.yarn test --scenario=SingleRootProjectand verified allBuildAndDebug SessionState Testspass.