@@ -283,19 +283,29 @@ class StudioActions {
283283 }
284284 return actionToProcess ;
285285 } )
286- . then (
287- ( actionToProcess ) =>
288- actionToProcess &&
286+ . then ( ( actionToProcess ) => {
287+ const attemptedEditLabel = getOtherStudioActionLabel ( OtherStudioAction . AttemptedEdit ) ;
288+ if ( afterUserAction && actionToProcess . errorText !== "" ) {
289+ if ( action . label === attemptedEditLabel ) {
290+ vscode . commands . executeCommand ( "undo" ) ;
291+ }
292+ outputChannel . appendLine ( actionToProcess . errorText ) ;
293+ outputChannel . show ( ) ;
294+ }
295+ actionToProcess &&
289296 ! afterUserAction &&
290297 this . processUserAction ( actionToProcess ) . then ( ( answer ) => {
298+ if ( ( action . label = attemptedEditLabel ) && answer !== "1" ) {
299+ vscode . commands . executeCommand ( "undo" ) ;
300+ }
291301 // call AfterUserAction only if there is a valid answer
292302 if ( answer ) {
293303 answer . msg || answer . msg === ""
294304 ? this . userAction ( action , true , answer . answer , answer . msg , type )
295305 : this . userAction ( action , true , answer , "" , type ) ;
296306 }
297- } )
298- )
307+ } ) ;
308+ } )
299309 . then ( ( ) => resolve ( ) )
300310 . catch ( ( err ) => {
301311 console . log ( err ) ;
@@ -379,7 +389,6 @@ class StudioActions {
379389 this . api . actionQuery ( query , [ this . name ] ) . then ( ( statusObj ) => {
380390 const docStatus = statusObj . result . content . pop ( ) ;
381391 if ( docStatus && ! docStatus . editable ) {
382- vscode . commands . executeCommand ( "undo" ) ;
383392 this . userAction ( actionObject , false , "" , "" , 1 ) ;
384393 }
385394 } ) ;
0 commit comments