@@ -33,7 +33,7 @@ import { FileChangesEvent, FileChangeType, IFileService } from 'vs/platform/file
3333import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
3434import { TreeResourceNavigator2 , WorkbenchObjectTree , getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService' ;
3535import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
36- import { ILocalProgressService , IProgressService } from 'vs/platform/progress/common/progress' ;
36+ import { IProgressService , IProgressStep , IProgress } from 'vs/platform/progress/common/progress' ;
3737import { IPatternInfo , ISearchComplete , ISearchConfiguration , ISearchConfigurationProperties , ITextQuery , SearchErrorCode , VIEW_ID , VIEWLET_ID } from 'vs/workbench/services/search/common/search' ;
3838import { ISearchHistoryService , ISearchHistoryValues } from 'vs/workbench/contrib/search/common/searchHistoryService' ;
3939import { diffInserted , diffInsertedOutline , diffRemoved , diffRemovedOutline , editorFindMatchHighlight , editorFindMatchHighlightBorder , listActiveSelectionForeground } from 'vs/platform/theme/common/colorRegistry' ;
@@ -129,7 +129,6 @@ export class SearchView extends ViewletPanel {
129129 options : IViewletPanelOptions ,
130130 @IFileService private readonly fileService : IFileService ,
131131 @IEditorService private readonly editorService : IEditorService ,
132- @ILocalProgressService private readonly localProgressService : ILocalProgressService ,
133132 @IProgressService private readonly progressService : IProgressService ,
134133 @INotificationService private readonly notificationService : INotificationService ,
135134 @IDialogService private readonly dialogService : IDialogService ,
@@ -518,13 +517,19 @@ export class SearchView extends ViewletPanel {
518517 return ;
519518 }
520519
521- const progressRunner = this . localProgressService . show ( 100 ) ;
522-
523520 const occurrences = this . viewModel . searchResult . count ( ) ;
524521 const fileCount = this . viewModel . searchResult . fileCount ( ) ;
525522 const replaceValue = this . searchWidget . getReplaceValue ( ) || '' ;
526523 const afterReplaceAllMessage = this . buildAfterReplaceAllMessage ( occurrences , fileCount , replaceValue ) ;
527524
525+ let progressComplete : ( ) => void ;
526+ let progressReporter : IProgress < IProgressStep > ;
527+ this . progressService . withProgress ( { location : VIEWLET_ID , delay : 100 , total : occurrences } , p => {
528+ progressReporter = p ;
529+
530+ return new Promise ( resolve => progressComplete = resolve ) ;
531+ } ) ;
532+
528533 const confirmation : IConfirmation = {
529534 title : nls . localize ( 'replaceAll.confirmation.title' , "Replace All" ) ,
530535 message : this . buildReplaceAllConfirmationMessage ( occurrences , fileCount , replaceValue ) ,
@@ -535,12 +540,12 @@ export class SearchView extends ViewletPanel {
535540 this . dialogService . confirm ( confirmation ) . then ( res => {
536541 if ( res . confirmed ) {
537542 this . searchWidget . setReplaceAllActionState ( false ) ;
538- this . viewModel . searchResult . replaceAll ( progressRunner ) . then ( ( ) => {
539- progressRunner . done ( ) ;
543+ this . viewModel . searchResult . replaceAll ( progressReporter ) . then ( ( ) => {
544+ progressComplete ( ) ;
540545 const messageEl = this . clearMessage ( ) ;
541546 dom . append ( messageEl , $ ( 'p' , undefined , afterReplaceAllMessage ) ) ;
542547 } , ( error ) => {
543- progressRunner . done ( ) ;
548+ progressComplete ( ) ;
544549 errors . isPromiseCanceledError ( error ) ;
545550 this . notificationService . error ( error ) ;
546551 } ) ;
0 commit comments