@@ -19,7 +19,6 @@ import * as manifest from '../manifest';
1919import { ConfigurationProvider } from '../vscode-api/configuration-provider' ;
2020import { OutputChannelProvider } from '../vscode-api/output-channel-provider' ;
2121import { CmsisToolboxManager } from './cmsis-toolbox' ;
22- import { SolutionManager } from './solution-manager' ;
2322import { CompileCommandsGenerator } from './intellisense/compile-commands-generator' ;
2423import { Mutex } from 'async-mutex' ;
2524import * as rpc from '../json-rpc/csolution-rpc-client' ;
@@ -39,7 +38,6 @@ export class SolutionConverterImpl implements SolutionConverter {
3938 private data : ConvertRequestData = { solutionPath : '' , targetSet : '' , updateRte : false , restartRpc : false } ;
4039
4140 constructor (
42- private readonly solutionManager : SolutionManager ,
4341 private readonly eventHub : SolutionEventHub ,
4442 private readonly configProvider : ConfigurationProvider ,
4543 private readonly outputChannelProvider : OutputChannelProvider ,
@@ -143,7 +141,8 @@ export class SolutionConverterImpl implements SolutionConverter {
143141
144142 let detection = false ;
145143 let convertResult : rpc . ConvertSolutionResult = { success : false } ;
146- const csolution = this . solutionManager . getCsolution ( ) ;
144+ let availableCompilers : string [ ] = [ ] ;
145+ let availableConfigurations : rpc . VariablesConfiguration [ ] | undefined ;
147146 if ( ! missingPacksResult || missingPacksResult . success ) {
148147 // rpc method: ConvertSolution
149148 outputChannel . append ( 'Convert solution... ' ) ;
@@ -160,14 +159,16 @@ export class SolutionConverterImpl implements SolutionConverter {
160159 return ;
161160 }
162161
163- // compilers and variables detection handling: apply select-compiler and discover layer configurations if any
164- csolution ?. setSelectCompiler ( convertResult . selectCompiler ) ;
162+ // compilers and variables detection: gather locally and emit configure event
163+ availableCompilers = convertResult . selectCompiler ?? [ ] ;
164+ detection = availableCompilers . length > 0 ;
165165 if ( convertResult . undefinedLayers ) {
166- const [ discoverLayersDetected , discoverLayersOutput ] = await this . checkDiscoverLayers ( ) ;
167- detection = discoverLayersDetected ;
166+ const result = await this . checkDiscoverLayers ( ) ;
167+ const discoverLayersOutput = ! result . success && result . message ? [ `error csolution: ${ result . message . trim ( ) } ` ] : [ ] ;
168168 toolsOutputMessages = toolsOutputMessages . concat ( discoverLayersOutput ) ;
169+ availableConfigurations = result . configurations ;
170+ detection = detection || result . success ;
169171 }
170- detection = detection || ! ! convertResult . selectCompiler ;
171172 }
172173
173174 let logResult = undefined ;
@@ -212,6 +213,10 @@ export class SolutionConverterImpl implements SolutionConverter {
212213 logMessages : logResult ,
213214 toolsOutputMessages,
214215 } ) ;
216+ // compilers and variables detection handling:
217+ // apply select-compiler and discover layer configurations, reset state otherwise
218+ this . eventHub . fireConfigureSolutionDataReady ( { availableCompilers, availableConfigurations } ) ;
219+
215220 }
216221
217222 private async printErrorsWarnings ( messages ?: rpc . LogMessages ) : Promise < void > {
@@ -249,9 +254,8 @@ export class SolutionConverterImpl implements SolutionConverter {
249254 return formattedOutput ;
250255 }
251256
252- private async checkDiscoverLayers ( ) : Promise < [ boolean , string [ ] ] > {
257+ private async checkDiscoverLayers ( ) {
253258 const outputChannel = this . outputChannelProvider . getOrCreate ( manifest . CMSIS_SOLUTION_OUTPUT_CHANNEL ) ;
254- this . solutionManager . getCsolution ( ) ?. setVariablesConfigurations ( undefined ) ;
255259 // rpc method: DiscoverLayers
256260 outputChannel . append ( 'Discover Layers... ' ) ;
257261 const result = await this . cmsisToolboxManager . runCsolutionRpc (
@@ -261,9 +265,7 @@ export class SolutionConverterImpl implements SolutionConverter {
261265 activeTarget : this . data ?. targetSet ?? '' ,
262266 }
263267 ) as rpc . DiscoverLayersInfo ;
264- this . solutionManager . getCsolution ( ) ?. setVariablesConfigurations ( result . configurations ) ;
265- const formattedOutput = ! result . success && result . message ? [ `error csolution: ${ result . message . trim ( ) } ` ] : [ ] ;
266- return [ result . success , formattedOutput ] ;
268+ return result ;
267269 }
268270
269271 private getSeverity ( messages : rpc . LogMessages , lines ?: string [ ] ) : Severity {
0 commit comments