inline chat tweaks (#183520)

* move toggle diff btn into drop down menu
* fix a few issues when restoring an IE session
This commit is contained in:
Johannes Rieken 2023-05-26 12:55:05 +02:00 committed by GitHub
parent bd3a8b6eb5
commit 4661aa6e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View file

@ -306,6 +306,7 @@ export class DiscardAction extends AbstractInteractiveEditorAction {
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
group: '0_main',
order: 0
}
});
@ -330,6 +331,7 @@ export class DiscardToClipboardAction extends AbstractInteractiveEditorAction {
// },
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
group: '0_main',
order: 1
}
});
@ -353,6 +355,7 @@ export class DiscardUndoToNewFileAction extends AbstractInteractiveEditorAction
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT),
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
group: '0_main',
order: 2
}
});
@ -420,12 +423,12 @@ export class ToggleInlineDiff extends AbstractInteractiveEditorAction {
title: localize('toggleDiff', 'Toggle Diff'),
icon: Codicon.diff,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT),
toggled: CTX_INTERACTIVE_EDITOR_SHOWING_DIFF,
toggled: { condition: CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, title: localize('toggleDiff2', "Show Inline Diff") },
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_STATUS,
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview),
group: '0_main',
order: 10
group: '1_config',
order: 9
}
});
}

View file

@ -257,6 +257,7 @@ export class InteractiveEditorController implements IEditorContribution {
this._zone.widget.updateSlashCommands(this._activeSession.session.slashCommands ?? []);
this._zone.widget.placeholder = this._getPlaceholderText();
this._zone.widget.value = this._activeSession.lastInput ?? '';
this._zone.widget.updateInfo(this._activeSession.session.message ?? localize('welcome.1', "AI-generated code may be incorrect"));
this._zone.show(this._activeSession.wholeRange.getEndPosition());
@ -558,6 +559,7 @@ export class InteractiveEditorController implements IEditorContribution {
try {
this._ignoreModelContentChanged = true;
await this._strategy.renderChanges(response);
this._ctxDidEdit.set(this._activeSession.hasChangedText);
} finally {
this._ignoreModelContentChanged = false;
}

View file

@ -424,6 +424,7 @@ export class InteractiveEditorWidget {
this._elements.statusToolbar.classList.toggle('hidden', !show);
this._elements.feedbackToolbar.classList.toggle('hidden', !show);
this._elements.status.classList.toggle('actions', show);
this._elements.infoLabel.classList.toggle('hidden', show);
this._onDidChangeHeight.fire();
}