@@ -283,19 +283,29 @@ class StudioActions {
283
283
}
284
284
return actionToProcess ;
285
285
} )
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 &&
289
296
! afterUserAction &&
290
297
this . processUserAction ( actionToProcess ) . then ( ( answer ) => {
298
+ if ( ( action . label = attemptedEditLabel ) && answer !== "1" ) {
299
+ vscode . commands . executeCommand ( "undo" ) ;
300
+ }
291
301
// call AfterUserAction only if there is a valid answer
292
302
if ( answer ) {
293
303
answer . msg || answer . msg === ""
294
304
? this . userAction ( action , true , answer . answer , answer . msg , type )
295
305
: this . userAction ( action , true , answer , "" , type ) ;
296
306
}
297
- } )
298
- )
307
+ } ) ;
308
+ } )
299
309
. then ( ( ) => resolve ( ) )
300
310
. catch ( ( err ) => {
301
311
console . log ( err ) ;
@@ -379,7 +389,6 @@ class StudioActions {
379
389
this . api . actionQuery ( query , [ this . name ] ) . then ( ( statusObj ) => {
380
390
const docStatus = statusObj . result . content . pop ( ) ;
381
391
if ( docStatus && ! docStatus . editable ) {
382
- vscode . commands . executeCommand ( "undo" ) ;
383
392
this . userAction ( actionObject , false , "" , "" , 1 ) ;
384
393
}
385
394
} ) ;
0 commit comments