diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts index 1f70852b039..48aa66b8d24 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts @@ -373,10 +373,12 @@ export class InlineChatController implements IEditorContribution { this._messages.fire(msg); })); + const altVersionNow = this._editor.getModel()?.getAlternativeVersionId(); + this._sessionStore.add(this._editor.onDidChangeModelContent(e => { if (!this._ignoreModelContentChanged && this._strategy?.hasFocus()) { - this._ctxUserDidEdit.set(true); + this._ctxUserDidEdit.set(altVersionNow !== this._editor.getModel()?.getAlternativeVersionId()); } if (this._ignoreModelContentChanged || this._strategy?.hasFocus()) { @@ -467,7 +469,12 @@ export class InlineChatController implements IEditorContribution { const { lastExchange } = this._activeSession; this._activeSession.addInput(lastExchange.prompt.retry()); if (lastExchange.response instanceof EditResponse) { - await this._strategy.undoChanges(lastExchange.response); + try { + this._ignoreModelContentChanged = true; + await this._strategy.undoChanges(lastExchange.response); + } finally { + this._ignoreModelContentChanged = false; + } } return State.MAKE_REQUEST; }