Skip to content

Commit f07f38b

Browse files
committed
update response type when showing, not when receiving
fix outdated context key
1 parent b286478 commit f07f38b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export class InteractiveEditorController implements IEditorContribution {
244244
this._zone.widget.updateSlashCommands(this._activeSession.session.slashCommands ?? []);
245245
this._zone.widget.placeholder = this._activeSession.session.placeholder ?? '';
246246
this._zone.widget.updateStatus(this._activeSession.session.message ?? localize('welcome.1', "AI-generated code may be incorrect"));
247+
this._zone.show(this._activeSession.wholeRange.getEndPosition());
247248

248249
this._sessionStore.add(this._editor.onDidChangeModel(() => {
249250
this._messages.fire(this._activeSession?.lastExchange
@@ -403,7 +404,6 @@ export class InteractiveEditorController implements IEditorContribution {
403404

404405
} finally {
405406
this._ctxHasActiveRequest.set(false);
406-
this._ctxLastResponseType.set(reply?.type);
407407
this._zone.widget.updateProgress(false);
408408
this._logService.trace('[IE] request took', sw.elapsed(), this._activeSession.provider.debugName);
409409

@@ -432,7 +432,6 @@ export class InteractiveEditorController implements IEditorContribution {
432432
if (response instanceof EditResponse) {
433433
// edit response -> complex...
434434
this._zone.widget.updateMarkdownMessage(undefined);
435-
this._zone.widget.updateToolbar(true);
436435

437436
const canContinue = this._strategy.checkChanges(response);
438437
if (!canContinue) {
@@ -465,6 +464,10 @@ export class InteractiveEditorController implements IEditorContribution {
465464

466465
const { response } = this._activeSession.lastExchange!;
467466

467+
this._ctxLastResponseType.set(response instanceof EditResponse || response instanceof MarkdownResponse
468+
? response.raw.type
469+
: undefined);
470+
468471
if (response instanceof EmptyResponse) {
469472
// show status message
470473
this._zone.widget.updateStatus(localize('empty', "No results, please refine your input and try again"), { classes: ['warn'] });

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ export class InteractiveEditorWidget {
372372
updateMarkdownMessage(message: Node | undefined) {
373373
this._elements.markdownMessage.classList.toggle('hidden', !message);
374374
if (!message) {
375+
this._ctxMessageCropState.reset();
375376
reset(this._elements.message);
376377

377378
} else {

0 commit comments

Comments
 (0)