Skip to content

Commit 8965cb9

Browse files
authored
checkpoint polish 💅🏻 (microsoft#258711)
some checkpoint cleanup
1 parent aa33e55 commit 8965cb9

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatClearActions.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,17 @@ export function registerNewChatActions() {
211211
while (editingSession.canRedo.get()) {
212212
await editingSession.redoInteraction();
213213
}
214-
widget.lastFocusedWidget?.viewModel?.model.setCheckpoint(undefined);
214+
215+
const currentWidget = widget.lastFocusedWidget;
216+
const requestText = currentWidget?.viewModel?.model.checkpoint?.message.text;
217+
218+
// if the input has the same text that we just restored, clear it.
219+
if (currentWidget?.inputEditor.getValue() === requestText) {
220+
currentWidget?.input.setValue('', false);
221+
}
222+
223+
currentWidget?.viewModel?.model.setCheckpoint(undefined);
224+
currentWidget?.focusInput();
215225
}
216226
});
217227
}

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ registerAction2(class RestoreCheckpointAction extends Action2 {
429429
constructor() {
430430
super({
431431
id: 'workbench.action.chat.restoreCheckpoint',
432-
title: localize2('chat.restoreCheckpoint.label', "Restore checkpoint"),
432+
title: localize2('chat.restoreCheckpoint.label', "Restore Checkpoint"),
433433
tooltip: localize2('chat.restoreCheckpoint.tooltip', "Restores workspace and chat to this point"),
434434
f1: false,
435435
category: CHAT_CATEGORY,

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
430430
const codiconRestoreContainer = dom.append(checkpointRestoreContainer, $('.codicon-container'));
431431
dom.append(codiconRestoreContainer, $('span.codicon.codicon-bookmark'));
432432
const label = dom.append(checkpointRestoreContainer, $('span.checkpoint-label-text'));
433-
label.textContent = localize('checkpointRestore', 'Checkpoint restored');
433+
label.textContent = localize('checkpointRestore', 'Checkpoint Restored');
434434
const checkpointRestoreToolbar = templateDisposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, checkpointRestoreContainer, MenuId.ChatMessageRestoreCheckpoint, {
435435
actionViewItemProvider: (action, options) => {
436436
if (action instanceof MenuItemAction) {

src/vs/workbench/contrib/chat/browser/media/chat.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,8 +2210,8 @@ display: none;
22102210
width: fit-content;
22112211
user-select: none;
22122212
position: absolute;
2213-
top: 5px;
2214-
left: 25px;
2213+
top: 4px;
2214+
margin-left: 25px;
22152215
background: var(--vscode-sideBar-background);
22162216
}
22172217

@@ -2228,14 +2228,14 @@ display: none;
22282228
.checkpoint-label-text {
22292229
font-size: 12px;
22302230
color: var(--vscode-descriptionForeground);
2231-
padding-right: 4px;
2231+
background-color: var(--vscode-sideBar-background);
2232+
padding: 4px;
22322233
display: flex;
22332234
align-items: center;
22342235
gap: 4px;
2235-
}
2236-
2237-
.monaco-toolbar {
2238-
left: 145px;
2236+
position: absolute;
2237+
margin-left: 71px;
2238+
margin-top: 2px;
22392239
}
22402240
}
22412241

0 commit comments

Comments
 (0)