Skip to content

Commit

Permalink
inline chat tweaks (#183520)
Browse files Browse the repository at this point in the history
* move toggle diff btn into drop down menu
* fix a few issues when restoring an IE session
  • Loading branch information
jrieken committed May 26, 2023
1 parent bd3a8b6 commit 4661aa6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export class DiscardAction extends AbstractInteractiveEditorAction {
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
group: '0_main',
order: 0
}
});
Expand All @@ -330,6 +331,7 @@ export class DiscardToClipboardAction extends AbstractInteractiveEditorAction {
// },
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
group: '0_main',
order: 1
}
});
Expand All @@ -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
}
});
Expand Down Expand Up @@ -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
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 4661aa6

Please sign in to comment.