Skip to content

Commit 83284fe

Browse files
committed
Remove all checkpoint-related functionality and associated UI components from panel
- remove history/checkpoints handling from the panel (we're showing it now somewhere else), note that 'response history' is a different feature - remove panel-related logic from 'checkpoints' feature - remove 'show progress', 'hide progress', 'SHOW_AUTO_CLOSING_MODAL' message passing and remove related, now unnecessary params - make native progress required, skip such redundant assignments const progress = native_progress - remove panel_provider.send_checkpoints - restore the use of 'Tabs' [Changes]
1 parent 5926740 commit 83284fe

31 files changed

Lines changed: 93 additions & 1297 deletions

‎apps/editor/src/commands/apply-chat-response-command/apply-chat-response-command.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ export const apply_chat_response_command = (params: {
428428
CHECKPOINTS_STATE_KEY,
429429
checkpoints
430430
)
431-
await params.panel_provider.send_checkpoints()
432431
}
433432
}
434433

‎apps/editor/src/commands/history-command.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
import { PanelProvider } from '@/views/panel/backend/panel-provider'
2222
import { get_checkpoint_path } from '@/features/checkpoints/utils'
2323
import { dictionary } from '@shared/constants/dictionary'
24-
import { checkpoints_emitter } from '@/features/checkpoints/events'
2524
import { get_response_preview_promise_resolve } from '@/commands/apply-chat-response-command/utils/preview/preview'
2625

2726
dayjs.extend(localizedFormat)
@@ -268,7 +267,7 @@ export const history_command = (params: {
268267
checkpoint: temp_checkpoint,
269268
workspace_provider: params.workspace_provider,
270269
context: params.context,
271-
options: { skip_confirmation: true, use_native_progress: true },
270+
options: { skip_confirmation: true },
272271
panel_provider: params.panel_provider
273272
})
274273
// After reverting, delete the temp checkpoint and clear state.
@@ -281,15 +280,13 @@ export const history_command = (params: {
281280
checkpoint_to_delete: temp_checkpoint,
282281
panel_provider: params.panel_provider
283282
})
284-
checkpoints_emitter.emit('checkpoints-updated')
285283
} else if (selected.checkpoint) {
286284
quick_pick.hide()
287285
await restore_checkpoint({
288286
checkpoint: selected.checkpoint,
289287
workspace_provider: params.workspace_provider,
290288
context: params.context,
291-
panel_provider: params.panel_provider,
292-
options: { use_native_progress: true }
289+
panel_provider: params.panel_provider
293290
})
294291
}
295292
})
@@ -381,7 +378,6 @@ export const history_command = (params: {
381378
CHECKPOINTS_STATE_KEY,
382379
checkpoints
383380
)
384-
params.panel_provider.send_checkpoints()
385381
}
386382
}
387383
await refresh_and_update_view()

‎apps/editor/src/features/checkpoints/actions/clear-all-checkpoints.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export const clear_all_checkpoints = async (
5151
undefined
5252
)
5353
await context.workspaceState.update(CHECKPOINTS_STATE_KEY, [])
54-
await panel_provider.send_checkpoints()
5554
}
5655
await vscode.window.withProgress(
5756
{

‎apps/editor/src/features/checkpoints/actions/create-checkpoint.ts‎

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const create_checkpoint = async (params: {
2929
panel_provider: PanelProvider
3030
trigger?: CheckpointTrigger
3131
description?: string
32-
silent?: boolean
3332
}): Promise<Checkpoint | undefined> => {
3433
try {
3534
const trigger = params.trigger ?? 'manual'
@@ -220,37 +219,14 @@ export const create_checkpoint = async (params: {
220219
CHECKPOINTS_STATE_KEY,
221220
checkpoints
222221
)
223-
await params.panel_provider.send_checkpoints()
224222
await params.context.workspaceState.update(
225223
CHECKPOINT_OPERATION_IN_PROGRESS_STATE_KEY,
226224
undefined
227225
)
228226
new_checkpoint = checkpoint_object
229227
}
230228

231-
let timer: ReturnType<typeof setTimeout> | undefined
232-
let did_show_modal = false
233-
234-
try {
235-
if (!params.silent) {
236-
timer = setTimeout(() => {
237-
did_show_modal = true
238-
params.panel_provider.send_message({
239-
command: 'SHOW_PROGRESS',
240-
title: 'Creating checkpoint...'
241-
})
242-
}, 1000)
243-
}
244-
245-
await create_checkpoint_task()
246-
} finally {
247-
if (timer) clearTimeout(timer)
248-
if (did_show_modal) {
249-
params.panel_provider.send_message({
250-
command: 'HIDE_PROGRESS'
251-
})
252-
}
253-
}
229+
await create_checkpoint_task()
254230
return new_checkpoint
255231
} catch (err: any) {
256232
vscode.window.showErrorMessage(

‎apps/editor/src/features/checkpoints/actions/delete-checkpoint.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const delete_checkpoint = async (params: {
2323
CHECKPOINTS_STATE_KEY,
2424
updated_checkpoints
2525
)
26-
await params.panel_provider.send_checkpoints()
2726

2827
try {
2928
const checkpoint_path = get_checkpoint_path(
@@ -74,7 +73,6 @@ export const delete_checkpoint_with_undo = async (params: {
7473
CHECKPOINTS_STATE_KEY,
7574
updated_checkpoints
7675
)
77-
await params.panel_provider.send_checkpoints()
7876
params.on_did_update_checkpoints?.(updated_checkpoints)
7977

8078
const finalize = async () => {
@@ -122,7 +120,6 @@ export const delete_checkpoint_with_undo = async (params: {
122120
CHECKPOINTS_STATE_KEY,
123121
current_checkpoints
124122
)
125-
await params.panel_provider.send_checkpoints()
126123
params.on_did_update_checkpoints?.(current_checkpoints)
127124

128125
params.on_before_show_message?.()

‎apps/editor/src/features/checkpoints/actions/restore-checkpoint.ts‎

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ import { ongoing_preview_cleanup_promise } from '@/commands/apply-chat-response-
2222
import { dictionary } from '@shared/constants/dictionary'
2323
import { get_git_info } from '../utils/git-utils'
2424
import { PromptsForCommitMessagesUtils } from '@/utils/prompts-for-commit-messages-utils'
25-
import { checkpoints_emitter } from '../events'
26-
2725
export const restore_checkpoint = async (params: {
2826
checkpoint: Checkpoint
2927
workspace_provider: WorkspaceProvider
3028
context: vscode.ExtensionContext
3129
panel_provider: PanelProvider
3230
options?: {
3331
skip_confirmation?: boolean
34-
use_native_progress?: boolean
35-
show_auto_closing_modal_on_success?: boolean
3632
}
3733
}) => {
3834
const operation_in_progress = params.context.workspaceState.get<number>(
@@ -49,37 +45,9 @@ export const restore_checkpoint = async (params: {
4945
? 'Reverting...'
5046
: 'Restoring checkpoint...'
5147

52-
let current_progress = 0
53-
let progress_reporter:
54-
| vscode.Progress<{ message?: string; increment?: number }>
55-
| undefined
56-
57-
if (!params.options?.use_native_progress) {
58-
params.panel_provider.send_message({
59-
command: 'SHOW_PROGRESS',
60-
title,
61-
delay_visibility: false
62-
})
63-
progress_reporter = {
64-
report: (value) => {
65-
if (value.increment) {
66-
current_progress += value.increment
67-
params.panel_provider.send_message({
68-
command: 'SHOW_PROGRESS',
69-
title,
70-
progress: Math.min(current_progress, 100),
71-
delay_visibility: false
72-
})
73-
}
74-
}
75-
}
76-
}
77-
7848
const main_task = async (
79-
native_progress?: vscode.Progress<{ message?: string; increment?: number }>
49+
progress: vscode.Progress<{ message?: string; increment?: number }>
8050
) => {
81-
const progress = native_progress || progress_reporter
82-
8351
if (
8452
params.checkpoint.trigger == 'response-accepted' &&
8553
params.checkpoint.description
@@ -136,8 +104,7 @@ export const restore_checkpoint = async (params: {
136104
workspace_provider: params.workspace_provider,
137105
context: params.context,
138106
panel_provider: params.panel_provider,
139-
trigger: 'before-checkpoint-restored',
140-
silent: true
107+
trigger: 'before-checkpoint-restored'
141108
})
142109
}
143110

@@ -543,55 +510,31 @@ export const restore_checkpoint = async (params: {
543510

544511
let temp_check: Checkpoint | undefined
545512
try {
546-
if (params.options?.use_native_progress) {
547-
temp_check = await vscode.window.withProgress(
548-
{
549-
location: vscode.ProgressLocation.Notification,
550-
title,
551-
cancellable: false
552-
},
553-
main_task
554-
)
555-
} else {
556-
temp_check = await main_task()
557-
}
513+
temp_check = await vscode.window.withProgress(
514+
{
515+
location: vscode.ProgressLocation.Notification,
516+
title,
517+
cancellable: false
518+
},
519+
main_task
520+
)
558521
} catch (e) {
559522
return
560-
} finally {
561-
if (!params.options?.use_native_progress) {
562-
params.panel_provider.send_message({
563-
command: 'HIDE_PROGRESS'
564-
})
565-
}
566-
checkpoints_emitter.emit('checkpoints-updated')
567523
}
568524

569525
const message = params.options?.skip_confirmation
570526
? 'Successfully reverted changes.'
571527
: 'Checkpoint has been restored.'
572528

573-
if (params.checkpoint.trigger == 'response-accepted') {
574-
params.panel_provider.send_message({
575-
command: 'SHOW_PROGRESS',
576-
title: message.endsWith('.') ? message.slice(0, -1) : message,
577-
cancellable: false,
578-
delay_visibility: true
579-
})
580-
} else if (params.options?.show_auto_closing_modal_on_success) {
581-
params.panel_provider.send_message({
582-
command: 'SHOW_AUTO_CLOSING_MODAL',
583-
title: message.slice(0, -1),
584-
type: 'success'
585-
})
586-
} else if (temp_check) {
529+
if (temp_check) {
587530
const action = await vscode.window.showInformationMessage(message, 'Revert')
588531
if (action == 'Revert') {
589532
await restore_checkpoint({
590533
checkpoint: temp_check,
591534
workspace_provider: params.workspace_provider,
592535
context: params.context,
593536
panel_provider: params.panel_provider,
594-
options: { skip_confirmation: true, use_native_progress: true }
537+
options: { skip_confirmation: true }
595538
})
596539
await params.context.workspaceState.update(
597540
TEMPORARY_CHECKPOINT_STATE_KEY,
@@ -602,7 +545,6 @@ export const restore_checkpoint = async (params: {
602545
checkpoint_to_delete: temp_check,
603546
panel_provider: params.panel_provider
604547
})
605-
checkpoints_emitter.emit('checkpoints-updated')
606548
}
607549
} else {
608550
vscode.window.showInformationMessage(message)

‎apps/editor/src/features/checkpoints/actions/toggle-checkpoint-star.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ export const toggle_checkpoint_star = async (params: {
2222
CHECKPOINTS_STATE_KEY,
2323
checkpoints
2424
)
25-
await params.panel_provider.send_checkpoints()
2625
}
2726
}

‎apps/editor/src/features/checkpoints/actions/update-checkpoint-description.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ export const update_checkpoint_description = async (params: {
2323
CHECKPOINTS_STATE_KEY,
2424
checkpoints
2525
)
26-
await params.panel_provider.send_checkpoints()
2726
}
2827
}

‎apps/editor/src/features/checkpoints/events.ts‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎apps/editor/src/views/panel/backend/message-handlers/checkpoints/handle-clear-all-checkpoints.ts‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)