Conversation
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
|
@copilot a new terminal is only needed once |
The implementation only checks and recreates the terminal when Flow:
|
@copilot can you update the PR description clarifying this? |
Updated the PR description with a new "Important: Terminal Recreation Timing" section that clarifies this behavior. |
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
snehara99
left a comment
There was a problem hiding this comment.
Tested locally, and the fix appropriately updates the directory path.
|
@copilot can you use |
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
This change addresses item #4549
This changes visible behavior
The following changes are proposed:
cwdcomparison to terminal reuse logic increateTerminal()The purpose of this change
When switching Configuration Presets or changing
cmake.buildDirectory, the launch terminal's working directory was not updated. The terminal reuse logic only compared environment variables:Now also checks
cwdusingJSON.stringify()for consistency:This ensures a new terminal is created with the correct working directory when the build directory changes.
Other Notes/Information
Terminal Recreation Timing: The terminal is only recreated when the user explicitly runs
CMake: Run Without Debugging. ThecreateTerminal()method is private and only called fromlaunchTarget(). Directory changes alone do not trigger terminal recreation.Flow:
launchTarget()callscreateTerminal()createTerminal()compares new cwd with existing terminal's cwdOriginal prompt
This section details on the original issue you should resolve
<issue_title>[Bug] current working directory is not changed when using
CMake: Run Without Debugging</issue_title><issue_description>### Brief Issue Summary
When
binaryDiris changed by changing Configuration Preset, or by usingcmake.buildDirectoryinsettings.jsonfile,CMake: Run Without Debugging(fromstatus baror viaCommand Palette) doesn't change directory ofCmake/Launchterminal.CMake Tools Diagnostics
{ "os": "win32", "vscodeVersion": "1.103.1", "cmtVersion": "1.21.36", "configurations": [ { "folder": "e:\\DEV\\C++\\Projects\\vscode-cmake-wrong-directory", "cmakeVersion": "4.1.0", "configured": true, "generator": "Ninja", "usesPresets": true, "compilers": { "C": "cl.exe", "CXX": "cl.exe" } } ], "cpptoolsIntegration": { "isReady": true, "hasCodeModel": true, "activeBuildType": "Release", "buildTypesSeen": [ "Release" ], "requests": [], "responses": [], "partialMatches": [], "targetCount": 1, "executablesCount": 1, "librariesCount": 0, "targets": [ { "name": "HelloWorld", "type": "EXECUTABLE" } ] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "always", "configureOnOpen": true } ] }Debug Log
Additional Information
Using a simple c++ program to print current path:


Steps to reproduce:
CMake: Run Without DebuggingCMake: Run Without DebuggingCMake: Run Without DebuggingCMake: Run Without DebuggingGCC-DebugdirectoryAlso, I noticed that changing compiler to or from MSVC resets
CMake/launchterminal (probably to set up environment) and because of this reset changing compiler to or from MSVC doesn't cause this issue. (changing configuration while in MSVC still causes this issue though)Changing compiler between
GCCandClangcauses this issue because terminal is not reset.</issue_description><agent_instructions>You are Copilot coding agent acting as a senior maintainer/contributor for the VS Code extension repository microsoft/vscode-cmake-tools.
You are deeply familiar with CMake, CMake Presets, CTest, kit/toolchain selection, VS Code extension APIs, and the architecture of this repo.
Your job is to resolve the...
CMake: Run Without Debugging#4549✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.