Skip to content

Commit 8399bee

Browse files
committed
finish editor chat session when disposing editor
1 parent fb8bf97 commit 8399bee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ export class InteractiveEditorController implements IEditorContribution {
131131
}
132132

133133
dispose(): void {
134+
this._finishExistingSession();
134135
this._store.dispose();
135-
this.cancelSession();
136136
}
137137

138138
getId(): string {
@@ -156,19 +156,19 @@ export class InteractiveEditorController implements IEditorContribution {
156156

157157
async run(options: InteractiveEditorRunOptions | undefined): Promise<void> {
158158
this._logService.trace('[IE] session starting');
159-
await this._finishOrCancel();
159+
await this._finishExistingSession();
160160

161161
await this._nextState(State.CREATE_SESSION, { ...options });
162162
this._logService.trace('[IE] session done or paused');
163163
}
164164

165-
private async _finishOrCancel(): Promise<void> {
165+
private async _finishExistingSession(): Promise<void> {
166166
if (this._activeSession) {
167167
if (this._activeSession.editMode === EditMode.Preview) {
168-
this._logService.trace('[IE] an EXISTING session is active, cancelling first');
168+
this._logService.trace('[IE] finishing existing session, using CANCEL', this._activeSession.editMode);
169169
await this.cancelSession();
170170
} else {
171-
this._logService.trace('[IE] an EXISTING session is active, finishing first');
171+
this._logService.trace('[IE] finishing existing session, using APPLY', this._activeSession.editMode);
172172
await this.applyChanges();
173173
}
174174
}
@@ -292,7 +292,7 @@ export class InteractiveEditorController implements IEditorContribution {
292292
// cancel all sibling sessions
293293
for (const editor of editors) {
294294
if (editor !== this._editor) {
295-
InteractiveEditorController.get(editor)?._finishOrCancel();
295+
InteractiveEditorController.get(editor)?._finishExistingSession();
296296
}
297297
}
298298
break;

0 commit comments

Comments
 (0)