From 1ad5fa669c36c73ddd99bc0d937a060b16b50ba9 Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 27 Sep 2023 15:56:12 +0200 Subject: [PATCH] fix https://github.com/microsoft/vscode/issues/192881 --- .../inlineChat/browser/inlineChatController.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; }