From f5b64ee07941c9d75c9c23815225a02bf74dc04b Mon Sep 17 00:00:00 2001 From: Johannes Date: Fri, 12 May 2023 14:27:10 +0200 Subject: [PATCH] some more polish --- .../browser/interactiveEditorController.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts b/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts index be47bbe4a0515..5487f2aa4e289 100644 --- a/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts +++ b/src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditorController.ts @@ -144,22 +144,20 @@ export class InteractiveEditorController implements IEditorContribution { this._logService.trace('[IE] session done or paused'); } + // ---- state machine + private async _nextState(state: State, options: InteractiveEditorRunOptions | undefined): Promise { this._logService.trace('[IE] setState to ', state); let nextState: State | undefined; switch (state) { case State.CREATE_SESSION: nextState = await this._createSession(options); - delete options?.initialRange; - delete options?.existingSession; break; case State.INIT_UI: nextState = await this._initUI(); break; case State.WAIT_FOR_INPUT: nextState = await this._waitForInput(options); - delete options?.message; - delete options?.autoSend; break; case State.MAKE_REQUEST: nextState = await this._makeRequest(); @@ -204,6 +202,9 @@ export class InteractiveEditorController implements IEditorContribution { msgListener.dispose(); } + delete options?.initialRange; + delete options?.existingSession; + if (!session) { return State.DONE; } @@ -303,11 +304,13 @@ export class InteractiveEditorController implements IEditorContribution { if (options?.message) { this._zone.widget.value = options?.message; this._zone.widget.selectAll(); + delete options?.message; } let message = Message.NONE; if (options?.autoSend) { message = Message.ACCEPT_INPUT; + delete options?.autoSend; } else { const barrier = new Barrier();