@@ -852,6 +852,8 @@ export class InlineChatController implements IEditorContribution {
852
852
assertType ( this . _strategy ) ;
853
853
this . _sessionStore . clear ( ) ;
854
854
855
+ // only stash sessions that were not unstashed, not "empty", and not interacted with
856
+ const shouldStash = ! this . _session . isUnstashed && ! ! this . _session . lastExchange && this . _session . hunkData . size === this . _session . hunkData . pending ;
855
857
let undoCancelEdits : IValidEditOperation [ ] = [ ] ;
856
858
try {
857
859
undoCancelEdits = this . _strategy . cancel ( ) ;
@@ -862,8 +864,7 @@ export class InlineChatController implements IEditorContribution {
862
864
}
863
865
864
866
this . _stashedSession . clear ( ) ;
865
- if ( ! this . _session . isUnstashed && ! ! this . _session . lastExchange && this . _session . hunkData . size === this . _session . hunkData . pending ) {
866
- // only stash sessions that were not unstashed, not "empty", and not interacted with
867
+ if ( shouldStash ) {
867
868
this . _stashedSession . value = this . _inlineChatSessionService . stashSession ( this . _session , this . _editor , undoCancelEdits ) ;
868
869
} else {
869
870
this . _inlineChatSessionService . releaseSession ( this . _session ) ;
@@ -1142,7 +1143,11 @@ export class InlineChatController implements IEditorContribution {
1142
1143
}
1143
1144
1144
1145
unstashLastSession ( ) : Session | undefined {
1145
- return this . _stashedSession . value ?. unstash ( ) ;
1146
+ const result = this . _stashedSession . value ?. unstash ( ) ;
1147
+ if ( result ) {
1148
+ this . _inlineChatSavingService . markChanged ( result ) ;
1149
+ }
1150
+ return result ;
1146
1151
}
1147
1152
1148
1153
joinCurrentRun ( ) : Promise < void > | undefined {
0 commit comments