Skip to content

Commit 5282100

Browse files
CopilotOmotola
andauthored
Fix duplicate project nodes in Project Outline on rename (#4820)
* Initial plan * Fix duplicate project nodes in Project Outline on rename (#4343) When a CMake project is renamed in CMakeLists.txt, the Project Outline now replaces the existing node instead of creating a duplicate. The fix clears stale entries keyed by the old project name before inserting the new ProjectNode. Co-authored-by: Omotola <[email protected]> * Remove accidentally committed .npmrc.bak.old Co-authored-by: Omotola <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Omotola <[email protected]> Co-authored-by: Omotola <[email protected]>
1 parent ffe7f11 commit 5282100

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Improvements:
3131
- Honor `debugger.workingDirectory` from the CMake File API when debugging a target, so that the `DEBUGGER_WORKING_DIRECTORY` target property is used as the debugger working directory. [#4595](https://github.com/microsoft/vscode-cmake-tools/issues/4595)
3232

3333
Bug Fixes:
34+
- Fix renaming a CMake project creating a duplicate node in the Project Outline instead of replacing the existing one. [#4343](https://github.com/microsoft/vscode-cmake-tools/issues/4343)
3435
- Remove internal stack traces from the Output pane when a subprocess fails. Error messages now show only human-readable information; stack traces are still available in debug-level logging. [#4807](https://github.com/microsoft/vscode-cmake-tools/issues/4807)
3536
- Fix duplicate launch configurations in the ctest debug picker when both `.vscode/launch.json` and a `.code-workspace` file exist. [#4586](https://github.com/microsoft/vscode-cmake-tools/issues/4586)
3637
- Users can now debug with or without launch configurations from the test explorer. `cmake.ctest.neverDebugTestsWithLaunchConfiguration` can be set to `true` to bypass the quick pick menu where the launch configuration is selected. [#4790](https://github.com/microsoft/vscode-cmake-tools/issues/4790)

src/ui/projectOutline/projectOutline.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,9 @@ export class WorkspaceFolderNode extends BaseNode {
747747
const rootProject = projectOutlineModel.project;
748748
let item = this.getNode(cmakeProject, rootProject.name);
749749
if (!item) {
750+
// Remove stale entries for this cmakeProject so that a renamed
751+
// project replaces the old node instead of appearing alongside it.
752+
this.removeNodes(cmakeProject);
750753
item = new ProjectNode(rootProject.name, this.wsFolder, cmakeProject.folderPath);
751754
this.setNode(cmakeProject, rootProject.name, item);
752755
}

0 commit comments

Comments
 (0)