Skip to content

Commit d88605d

Browse files
committed
cleaning the code
1 parent 3c63244 commit d88605d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class StartSessionAction extends EditorAction2 {
6767
options = arg;
6868
}
6969
InlineChatController.get(editor)?.run(options);
70+
InlineChatController.get(editor)?.run(options);
7071
}
7172
}
7273

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,17 @@ export class InlineChatController implements IEditorContribution {
176176
return this._zone.value.position;
177177
}
178178

179+
private _currentRun?: Promise<void>;
180+
179181
async run(options: InlineChatRunOptions | undefined = {}): Promise<void> {
180-
this._log('session starting inside of run');
181-
console.log('before finishExistingSession inside of run');
182-
await this.finishExistingSession();
183-
console.log('after finish existing session inside of run');
182+
this.finishExistingSession();
183+
if (this._currentRun) {
184+
await this._currentRun;
185+
}
184186
this._stashedSession.clear();
185-
console.log('before calling create session inside of run');
186-
await this._nextState(State.CREATE_SESSION, options);
187-
this._log('session done or paused');
187+
this._currentRun = this._nextState(State.CREATE_SESSION, options);
188+
await this._currentRun;
189+
this._currentRun = undefined;
188190
}
189191

190192
// ---- state machine
@@ -833,7 +835,7 @@ export class InlineChatController implements IEditorContribution {
833835
return result;
834836
}
835837

836-
async finishExistingSession(): Promise<void> {
838+
finishExistingSession(): void {
837839
console.log('inside of finish existing session');
838840
console.log(this._activeSession);
839841
if (this._activeSession) {
@@ -846,6 +848,7 @@ export class InlineChatController implements IEditorContribution {
846848
console.log('before accepting inside of finish existing session');
847849
this.acceptSession();
848850
}
851+
849852
}
850853
console.log('at the end of finish existing session');
851854
}

0 commit comments

Comments
 (0)