Skip to content

Commit

Permalink
some more polish
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 12, 2023
1 parent ad42860 commit f5b64ee
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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();
Expand Down Expand Up @@ -204,6 +202,9 @@ export class InteractiveEditorController implements IEditorContribution {
msgListener.dispose();
}

delete options?.initialRange;
delete options?.existingSession;

if (!session) {
return State.DONE;
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f5b64ee

Please sign in to comment.