Skip to content

Commit

Permalink
Fix a regression when initializing with sourceDir in a subfolder (#3122)
Browse files Browse the repository at this point in the history
* Fix a regression when initializing with sourceDir in a subfolder

* this is more accurate for the node name

* reword changelog entry
  • Loading branch information
bobbrow authored Apr 20, 2023
1 parent 579d0d3 commit 73abb3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# What's New?

## 1.14
## 1.14.30
Bug Fixes:
- Fix extension crashes in the test explorer when `cmake.sourceDir` is a subfolder of `${workspaceFolder}`. [#3121](https://github.com/microsoft/vscode-cmake-tools/issues/3121)

## 1.14.29
Features:
- Test Explorer. [PR #3032](https://github.com/microsoft/vscode-cmake-tools/pull/3032)
- Add commands revealTestExplorer, refreshTests, and refreshTestsAll. [PR #3032](https://github.com/microsoft/vscode-cmake-tools/pull/3032)
Expand Down
7 changes: 4 additions & 3 deletions src/ctest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ export class CTestDriver implements vscode.Disposable {
const sourceDir = util.platformNormalizePath(driver.sourceDir);
const testExplorerRoot = initializedTestExplorer.items.get(sourceDir);
if (!testExplorerRoot) {
throw(localize('folder.not.found.in.test.explorer', 'Folder is not found in Test Explorer: {0}', sourceDir));
log.error(localize('folder.not.found.in.test.explorer', 'Folder is not found in Test Explorer: {0}', sourceDir));
return -1;
}
// Clear all children and re-add later
testExplorerRoot.children.replace([]);
Expand Down Expand Up @@ -833,8 +834,8 @@ export class CTestDriver implements vscode.Disposable {

if (this.projectController) {
for (const project of this.projectController.getAllCMakeProjects()) {
const folderPath = util.platformNormalizePath(project.folderPath);
const folderName = path.basename(project.folderPath);
const folderPath = util.platformNormalizePath(project.sourceDir);
const folderName = path.basename(project.sourceDir);
const testItem = testExplorer.createTestItem(folderPath, folderName);
testItem.description = folderPath;
testExplorer.items.add(testItem);
Expand Down

0 comments on commit 73abb3c

Please sign in to comment.