Skip to content

Commit d2302f4

Browse files
authored
Merge pull request microsoft#194300 from microsoft/joh/slight-marsupial
fix microsoft#192881
2 parents de461e0 + 1ad5fa6 commit d2302f4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ export class InlineChatController implements IEditorContribution {
248248
if (!needsMargin) {
249249
this._zone.value.setWidgetMargins(widgetPosition, 0);
250250
}
251+
}
252+
if (this._activeSession) {
251253
this._zone.value.updateBackgroundColor(widgetPosition, this._activeSession.wholeRange.value);
252254
}
253255
this._zone.value.show(widgetPosition);
@@ -371,10 +373,12 @@ export class InlineChatController implements IEditorContribution {
371373
this._messages.fire(msg);
372374
}));
373375

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

376380
if (!this._ignoreModelContentChanged && this._strategy?.hasFocus()) {
377-
this._ctxUserDidEdit.set(true);
381+
this._ctxUserDidEdit.set(altVersionNow !== this._editor.getModel()?.getAlternativeVersionId());
378382
}
379383

380384
if (this._ignoreModelContentChanged || this._strategy?.hasFocus()) {
@@ -465,7 +469,12 @@ export class InlineChatController implements IEditorContribution {
465469
const { lastExchange } = this._activeSession;
466470
this._activeSession.addInput(lastExchange.prompt.retry());
467471
if (lastExchange.response instanceof EditResponse) {
468-
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+
}
469478
}
470479
return State.MAKE_REQUEST;
471480
}

0 commit comments

Comments
 (0)