Implement session state tracking for "Run and Debug" button when Inte… - #14719
Implement session state tracking for "Run and Debug" button when Inte…#14719Prashant Kumar Rai (8prashant) wants to merge 7 commits into
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.
There was a problem hiding this comment.
✨Copilot (agent146): [Minor] Please add focused regression coverage for the event-driven behavior rather than testing only the exported helper. These four tests call updateBuildAndDebugSessionState directly, so they would still pass if any of the new onDidChangeActiveTextEditor, onDidOpenTextDocument, or onDidChangeWorkspaceFolders registrations were absent. They also never use a C++ URI outside the open workspace, so they would have passed the prior global-folder implementation as well. At minimum, add an external C++ source case that asserts isSourceFile === true and isFolderOpen === false, plus one listener-driven transition (ideally an active-document language change while IntelliSense is disabled) to cover the behavior this PR fixes.
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.