@@ -22,17 +22,13 @@ import { ongoing_preview_cleanup_promise } from '@/commands/apply-chat-response-
2222import { dictionary } from '@shared/constants/dictionary'
2323import { get_git_info } from '../utils/git-utils'
2424import { PromptsForCommitMessagesUtils } from '@/utils/prompts-for-commit-messages-utils'
25- import { checkpoints_emitter } from '../events'
26-
2725export 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 )
0 commit comments