Skip to content

Commit 7a5744d

Browse files
authored
1 parent 1444434 commit 7a5744d

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ export class InlineChatController implements IEditorContribution {
691691
this._zone.value.widget.updateFollowUps(undefined);
692692
this._zone.value.widget.updateProgress(true);
693693
this._zone.value.widget.updateInfo(!this._activeSession.lastExchange ? localize('thinking', "Thinking\u2026") : '');
694+
await this._strategy.start();
694695
this._ctxHasActiveRequest.set(true);
695696
reply = await raceCancellationError(Promise.resolve(task), requestCts.token);
696697

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export abstract class EditModeStrategy {
5959
this._onDidDiscard.dispose();
6060
}
6161

62+
abstract start(): Promise<void>;
63+
6264
abstract apply(): Promise<void>;
6365

6466
abstract cancel(): Promise<void>;
@@ -102,6 +104,10 @@ export class PreviewStrategy extends EditModeStrategy {
102104
super.dispose();
103105
}
104106

107+
async start() {
108+
// nothing to do
109+
}
110+
105111
async apply() {
106112

107113
if (!(this._session.lastExchange?.response instanceof ReplyResponse)) {
@@ -280,6 +286,10 @@ export class LiveStrategy extends EditModeStrategy {
280286
this._inlineDiffDecorations.visible = this._diffEnabled;
281287
}
282288

289+
async start() {
290+
// nothing to do
291+
}
292+
283293
async apply() {
284294
if (this._editCount > 0) {
285295
this._editor.pushUndoStop();
@@ -637,22 +647,27 @@ export class LiveStrategy3 extends EditModeStrategy {
637647
}
638648

639649
override dispose(): void {
640-
this._ctxCurrentChangeHasDiff.reset();
641-
this._ctxCurrentChangeShowsDiff.reset();
642-
this._modifiedRangesDecorations.clear();
650+
this._resetDiff();
643651
this._previewZone.rawValue?.dispose();
644-
this._sessionStore.dispose();
645652
this._store.dispose();
646653
super.dispose();
647654
}
648655

649-
650-
async apply() {
656+
private _resetDiff(): void {
651657
this._ctxCurrentChangeHasDiff.reset();
652658
this._ctxCurrentChangeShowsDiff.reset();
653659
this._sessionStore.clear();
654660
this._modifiedRangesDecorations.clear();
655661
this._modifiedRangesThatHaveBeenInteractedWith.length = 0;
662+
this._zone.widget.updateStatus('');
663+
}
664+
665+
async start() {
666+
this._resetDiff();
667+
}
668+
669+
async apply() {
670+
this._resetDiff();
656671
if (this._editCount > 0) {
657672
this._editor.pushUndoStop();
658673
}
@@ -666,11 +681,7 @@ export class LiveStrategy3 extends EditModeStrategy {
666681
}
667682

668683
async cancel() {
669-
this._ctxCurrentChangeHasDiff.reset();
670-
this._ctxCurrentChangeShowsDiff.reset();
671-
this._sessionStore.clear();
672-
this._modifiedRangesDecorations.clear();
673-
this._modifiedRangesThatHaveBeenInteractedWith.length = 0;
684+
this._resetDiff();
674685
const { textModelN: modelN, textModelNAltVersion, textModelNSnapshotAltVersion } = this._session;
675686
if (modelN.isDisposed()) {
676687
return;

0 commit comments

Comments
 (0)