@@ -84,8 +84,8 @@ export class ManageSolutionWebviewMain {
8484 }
8585
8686 private async handleSolutionLoadChange ( e : SolutionLoadStateChangeEvent ) : Promise < void > {
87- const { solutionPath : newPath , converted : newConverted , loaded : newLoaded } = e . newState ;
88- const { solutionPath : prevPath , converted : prevConverted , loaded : prevLoaded } = e . previousState ;
87+ const { solutionPath : newPath , converted : newConverted , loaded : newLoaded , activated : newActivated } = e . newState ;
88+ const { solutionPath : prevPath , converted : prevConverted , loaded : prevLoaded , activated : prevActivated } = e . previousState ;
8989
9090 if ( ! this . webviewManager . isPanelActive || ( newPath === prevPath && newConverted !== prevConverted ) ) {
9191 return ;
@@ -103,6 +103,8 @@ export class ManageSolutionWebviewMain {
103103 this . setBusyState ( false ) ;
104104 return ;
105105 }
106+ } else if ( newActivated !== prevActivated ) {
107+ csolutionChanged = true ;
106108 } else if ( newLoaded !== prevLoaded ) {
107109 csolutionChanged = true ;
108110 }
@@ -169,10 +171,6 @@ export class ManageSolutionWebviewMain {
169171 return dirname ( this . controller ?. solutionPath ?? '' ) ;
170172 }
171173
172- private getSolutionBasename ( ) : string {
173- return path . basename ( this . controller ?. solutionPath ?? '' ) || 'the solution' ;
174- }
175-
176174 public attachToPanel ( panel : vscode . WebviewPanel ) : void {
177175 this . webviewManager . attachPanel ( panel ) ;
178176 }
@@ -323,8 +321,8 @@ export class ManageSolutionWebviewMain {
323321 await this . updateDebuggerParameter ( '' , 'start-pname' , name ) ;
324322 }
325323
326- public async saveChanges ( ) : Promise < void > {
327- if ( ! this . isDirty ) {
324+ public async saveChanges ( force : boolean = false ) : Promise < void > {
325+ if ( ! this . isDirty && ! force ) {
328326 return ;
329327 }
330328 await this . setBusyState ( true ) ;
@@ -347,31 +345,13 @@ export class ManageSolutionWebviewMain {
347345 } ) ;
348346 }
349347
350- protected async querySaveModified ( ) : Promise < void > {
351- if ( ! this . isDirty ) {
352- return ;
353- }
354- // for now only yes/no answers are supported, cancel can be only triggered externally when changing solution
355- // todo: query all modifications from this and component views
356- const result = await vscode . window . showWarningMessage (
357- `Manage Solution: You have unsaved changes in ${ this . getSolutionBasename ( ) } . Do you want to save them?` ,
358- { modal : true } ,
359- 'Yes' ,
360- 'No'
361- ) ;
362- if ( result === 'Yes' ) {
363- await this . saveChanges ( ) ;
364- }
365- }
366-
367348 /**
368349 * Loads csolution.ym file for editing
369350 * @returns true if solution file is successfully loaded
370351 */
371352 protected async loadSolution ( ) : Promise < ETextFileResult > {
372353 const globalSolution = this . solutionManager . getCsolution ( ) ; // get global csolution
373354 if ( this . controller . solutionPath !== globalSolution ?. solutionPath ) {
374- // await this.querySaveModified();
375355 this . _controller = this . createController ( ) ; // todo: use clear instead
376356 }
377357 if ( ! globalSolution ) { // no solution is loaded in workspace
0 commit comments