@@ -59,6 +59,8 @@ function getOtherStudioActionLabel(action: OtherStudioAction): string {
5959 return label ;
6060}
6161
62+ const suppressEditListenerMap = new Map < string , boolean > ( ) ;
63+
6264class StudioActions {
6365 private uri : vscode . Uri ;
6466 private api : AtelierAPI ;
@@ -86,10 +88,6 @@ class StudioActions {
8688 outputChannel . appendLine ( errorText ) ;
8789 outputChannel . show ( ) ;
8890 }
89- if ( userAction . reload ) {
90- const document = vscode . window . activeTextEditor . document ;
91- loadChanges ( [ currentFile ( document ) ] ) ;
92- }
9391 if ( config ( ) . studioActionDebugOutput ) {
9492 outputChannel . appendLine ( JSON . stringify ( userAction ) ) ;
9593 }
@@ -267,6 +265,13 @@ class StudioActions {
267265 }
268266 const actionToProcess = data . result . content . pop ( ) ;
269267
268+ if ( actionToProcess . reload ) {
269+ const document = vscode . window . activeTextEditor . document ;
270+ const file = currentFile ( document ) ;
271+ suppressEditListenerMap . set ( file . uri . toString ( ) , true ) ;
272+ await loadChanges ( [ file ] ) ;
273+ }
274+
270275 // CSP pages should not have a progress bar
271276 if ( actionToProcess . action === 2 ) {
272277 resolve ( ) ;
@@ -359,6 +364,10 @@ class StudioActions {
359364 label : getOtherStudioActionLabel ( action ) ,
360365 } ;
361366 if ( action === OtherStudioAction . AttemptedEdit ) {
367+ if ( suppressEditListenerMap . has ( this . uri . toString ( ) ) ) {
368+ suppressEditListenerMap . delete ( this . uri . toString ( ) ) ;
369+ return ;
370+ }
362371 const query = "select * from %Atelier_v1_Utils.Extension_GetStatus(?)" ;
363372 this . api . actionQuery ( query , [ this . name ] ) . then ( ( statusObj ) => {
364373 const docStatus = statusObj . result . content . pop ( ) ;
0 commit comments