Skip to content

Commit 1ad5fa6

Browse files
committed
1 parent 1860ea1 commit 1ad5fa6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,12 @@ export class InlineChatController implements IEditorContribution {
373373
this._messages.fire(msg);
374374
}));
375375

376+
const altVersionNow = this._editor.getModel()?.getAlternativeVersionId();
377+
376378
this._sessionStore.add(this._editor.onDidChangeModelContent(e => {
377379

378380
if (!this._ignoreModelContentChanged && this._strategy?.hasFocus()) {
379-
this._ctxUserDidEdit.set(true);
381+
this._ctxUserDidEdit.set(altVersionNow !== this._editor.getModel()?.getAlternativeVersionId());
380382
}
381383

382384
if (this._ignoreModelContentChanged || this._strategy?.hasFocus()) {
@@ -467,7 +469,12 @@ export class InlineChatController implements IEditorContribution {
467469
const { lastExchange } = this._activeSession;
468470
this._activeSession.addInput(lastExchange.prompt.retry());
469471
if (lastExchange.response instanceof EditResponse) {
470-
await this._strategy.undoChanges(lastExchange.response);
472+
try {
473+
this._ignoreModelContentChanged = true;
474+
await this._strategy.undoChanges(lastExchange.response);
475+
} finally {
476+
this._ignoreModelContentChanged = false;
477+
}
471478
}
472479
return State.MAKE_REQUEST;
473480
}

0 commit comments

Comments
 (0)