@@ -47,16 +47,17 @@ import {
4747 addLaunchConfiguration ,
4848 cleanTestResultsPaneMessage ,
4949 forceLowerCaseDriveLetter ,
50- getWorkspaceRootPath ,
50+ getWorkspaceRootPaths ,
5151 loadLaunchFile ,
52+ mergeWorkspaceEnvResponses ,
5253 normalizePath ,
5354 openFileWithLineSelected ,
5455} from "./utilities" ;
5556
5657import {
5758 deleteSingleTest ,
5859 getCBTNamesFromFile ,
59- getDataForEnvironment ,
60+ getDataForEnvironmentFromAPI ,
6061 getDataForProject ,
6162 getWorkspaceEnvDataVPython ,
6263 loadTestScriptIntoEnvironment ,
@@ -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} ;
@@ -704,7 +703,7 @@ let vcastHasCodedTestsList: string[] = [];
704703
705704// Global cache for workspace-wide env data
706705// Used to avoid redundant API calls during refresh
707- let cachedWorkspaceEnvData : CachedWorkspaceData | null = null ;
706+ export let cachedWorkspaceEnvData : CachedWorkspaceData | null = null ;
708707
709708export function clearCachedWorkspaceEnvData ( ) : void {
710709 cachedWorkspaceEnvData = null ;
@@ -754,11 +753,11 @@ async function loadEnviroData(
754753 }
755754 } else {
756755 // Fallback in case the cache is not build, but it should be
757- return await getDataForEnvironment ( buildPathDir ) ;
756+ return await getDataForEnvironmentFromAPI ( buildPathDir ) ;
758757 }
759758 } else {
760759 // Individual environment fetch (e.g. adding new test scripts, coded tests, ...)
761- return await getDataForEnvironment ( buildPathDir ) ;
760+ return await getDataForEnvironmentFromAPI ( buildPathDir ) ;
762761 }
763762 // We have a valid build directory, but we couldn't find a matching VCE file in the workspace data.
764763 vectorMessage (
@@ -768,13 +767,19 @@ async function loadEnviroData(
768767}
769768
770769async 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/**
@@ -945,6 +950,7 @@ async function loadAllVCTests(
945950 vcastUnbuiltEnviroList = [ ] ;
946951 clearEnviroDataCache ( ) ;
947952 clearTestNodeCache ( ) ;
953+ clearCachedWorkspaceEnvData ( ) ;
948954
949955 // Resets the "used" and empty/unused compilers / testsuites
950956 clearGlobalCompilersAndTestsuites ( ) ;
@@ -1010,7 +1016,6 @@ async function loadAllVCTests(
10101016 // end if workspace folders
10111017
10121018 checkWorkspaceEnvDataForErrors ( ) ;
1013- clearCachedWorkspaceEnvData ( ) ;
10141019
10151020 // In case we have empty testsuites or compilers in the project,
10161021 // we won't find them in the Env data so we have to add them manually here
0 commit comments