Skip to content

Commit b30e0f2

Browse files
authored
Multiple workspacefolders fix (#289)
- Previously, when opening multiple workspace folders in a single VS Code session, the extension only scanned .vce files from the first folder and ignored all others. - Removed some redundant backend return.
1 parent 04ab430 commit b30e0f2

File tree

6 files changed

+46
-20
lines changed

6 files changed

+46
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
All notable changes to the "vectorcastTestExplorer" extension will be documented in this file.
44

5-
## [1.0.27] - 2025-12-17
5+
## [1.0.27] - 2025-12-15
66

77
### Bug fixes
88
- The LLM compatibility mode is now correctly applied to pre-run model usability checks too
99

10-
## [1.0.26] - 2025-12-15
10+
## [1.0.26] - 2025-12-17
1111

1212
### Added
1313
- Improved Reqs2x progress tracking to be more precise

python/vTestInterface.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ def processCommandLogic(mode, clicast, pathToUse, testString="", options=""):
804804
except Exception as err:
805805
errors.append(f"{vce_path}: {str(err)}")
806806

807-
topLevel["testData"] = enviro_list[0]["testData"] if enviro_list else []
808-
topLevel["unitData"] = enviro_list[0]["unitData"] if enviro_list else []
809807
topLevel["enviro"] = enviro_list
810808
if errors:
811809
topLevel["errors"] = errors

src/testPane.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ import {
4747
addLaunchConfiguration,
4848
cleanTestResultsPaneMessage,
4949
forceLowerCaseDriveLetter,
50-
getWorkspaceRootPath,
50+
getWorkspaceRootPaths,
5151
loadLaunchFile,
52+
mergeWorkspaceEnvResponses,
5253
normalizePath,
5354
openFileWithLineSelected,
5455
} from "./utilities";
@@ -133,16 +134,14 @@ type UnitData = {
133134
functionList: FunctionUnitData[];
134135
};
135136

136-
type EnviroData = {
137+
export type EnviroData = {
137138
vcePath: string;
138139
testData: FileTestData[];
139140
unitData: UnitData[];
140141
mockingSupport: boolean;
141142
};
142143

143-
type CachedWorkspaceData = {
144-
testData: FileTestData[];
145-
unitData: UnitData[];
144+
export type CachedWorkspaceData = {
146145
enviro: EnviroData[];
147146
errors?: string[];
148147
};
@@ -768,13 +767,19 @@ async function loadEnviroData(
768767
}
769768

770769
async function buildEnvDataCacheForCurrentDir() {
771-
const workspaceDir = getWorkspaceRootPath();
772-
if (workspaceDir) {
773-
cachedWorkspaceEnvData = await getWorkspaceEnvDataVPython(workspaceDir);
774-
} else {
775-
// This should not be possible as we have env data, but just in case
770+
const folderPaths = getWorkspaceRootPaths();
771+
if (!folderPaths.length) {
776772
vectorMessage("No workspace root found, cannot refresh environment data.");
773+
return;
777774
}
775+
776+
// Query each root in parallel
777+
const responses = await Promise.all(
778+
folderPaths.map((p) => getWorkspaceEnvDataVPython(p))
779+
);
780+
781+
// Merge them
782+
cachedWorkspaceEnvData = await mergeWorkspaceEnvResponses(responses);
778783
}
779784

780785
/**

src/utilities.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { errorLevel, vectorMessage } from "./messagePane";
99
import { getGlobalCoverageData } from "./vcastTestInterface";
1010
import { rebuildEnvironment } from "./vcastAdapter";
1111
import { rebuildEnvironmentCallback } from "./callbacks";
12+
import { CachedWorkspaceData, EnviroData } from "./testPane";
1213
import { executeWithRealTimeEchoWithProgress } from "./vcastCommandRunner";
1314
import { getVectorCastInstallationLocation } from "./vcastInstallation";
1415

@@ -413,12 +414,34 @@ export async function updateCoverageAndRebuildEnv() {
413414
/**
414415
* Returns the root of the opened workspace.
415416
*/
416-
export function getWorkspaceRootPath(): string | undefined {
417+
export function getWorkspaceRootPaths(): string[] {
417418
const folders = vscode.workspace.workspaceFolders;
418-
if (folders && folders.length > 0) {
419-
return folders[0].uri.fsPath;
419+
if (!folders || folders.length === 0) return [];
420+
return folders.map((f) => f.uri.fsPath);
421+
}
422+
423+
/**
424+
* Merges multiple workspace responses into a single CachedWorkspaceData object.
425+
*/
426+
export async function mergeWorkspaceEnvResponses(
427+
responses: CachedWorkspaceData[]
428+
): Promise<CachedWorkspaceData> {
429+
const allErrors: string[] = [];
430+
const allEnvs: EnviroData[] = [];
431+
432+
for (const resp of responses) {
433+
if (resp.errors) {
434+
allErrors.push(...resp.errors);
435+
}
436+
if (resp.enviro) {
437+
allEnvs.push(...resp.enviro);
438+
}
420439
}
421-
return undefined;
440+
441+
return {
442+
enviro: allEnvs,
443+
errors: allErrors.length ? allErrors : undefined,
444+
};
422445
}
423446

424447
export async function getFullEnvReport(

src/vcastAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ export async function getWorkspaceEnvDataVPython(
708708
);
709709
let jsonData = getJsonDataFromTestInterface(commandToRun, workspaceDir);
710710

711-
vectorMessage("Building environments data for workspace...");
711+
vectorMessage(`Building environments data for workspace: ${workspaceDir}`);
712712

713713
return jsonData;
714714
}

tests/internal/e2e/test/test_utils/vcast_utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import expectedBasisPathTests from "../basis_path_tests.json";
1919
import expectedAtgTests from "../atg_tests.json";
2020

2121
// Local VM takes longer and needs a higher TIMEOUT
22-
export const TIMEOUT = 180_000;
22+
export const TIMEOUT = 240_000;
2323

2424
export type ServerMethod =
2525
| "GET"

0 commit comments

Comments
 (0)