@@ -20,6 +20,9 @@ import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
2020import { Dialog } from 'vs/base/browser/ui/dialog/dialog' ;
2121import { attachDialogStyler } from 'vs/platform/theme/common/styler' ;
2222import { IThemeService } from 'vs/platform/theme/common/themeService' ;
23+ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
24+ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
25+ import { EventHelper } from 'vs/base/browser/dom' ;
2326
2427export class ProgressService2 implements IProgressService2 {
2528
@@ -34,7 +37,8 @@ export class ProgressService2 implements IProgressService2 {
3437 @INotificationService private readonly _notificationService : INotificationService ,
3538 @IStatusbarService private readonly _statusbarService : IStatusbarService ,
3639 @ILayoutService private readonly _layoutService : ILayoutService ,
37- @IThemeService private readonly _themeService : IThemeService
40+ @IThemeService private readonly _themeService : IThemeService ,
41+ @IKeybindingService private readonly _keybindingService : IKeybindingService
3842 ) { }
3943
4044 withProgress < R = unknown > ( options : IProgressOptions , task : ( progress : IProgress < IProgressStep > ) => Promise < R > , onDidCancel ?: ( ) => void ) : Promise < R > {
@@ -276,6 +280,10 @@ export class ProgressService2 implements IProgressService2 {
276280
277281 private _withDialogProgress < P extends Promise < R > , R = unknown > ( options : IProgressOptions , task : ( progress : IProgress < { message ?: string , increment ?: number } > ) => P , onDidCancel ?: ( ) => void ) : P {
278282 const disposables : IDisposable [ ] = [ ] ;
283+ const allowableCommands = [
284+ 'workbench.action.quit' ,
285+ 'workbench.action.reloadWindow'
286+ ] ;
279287
280288 let dialog : Dialog ;
281289
@@ -284,7 +292,17 @@ export class ProgressService2 implements IProgressService2 {
284292 this . _layoutService . container ,
285293 message ,
286294 [ options . cancellable ? localize ( 'cancel' , "Cancel" ) : localize ( 'dismiss' , "Dismiss" ) ] ,
287- { type : 'pending' }
295+ {
296+ type : 'pending' ,
297+ keyEventProcessor : ( event : StandardKeyboardEvent ) => {
298+ const resolved = this . _keybindingService . softDispatch ( event , this . _layoutService . container ) ;
299+ if ( resolved && resolved . commandId ) {
300+ if ( allowableCommands . indexOf ( resolved . commandId ) === - 1 ) {
301+ EventHelper . stop ( event , true ) ;
302+ }
303+ }
304+ }
305+ }
288306 ) ;
289307
290308 disposables . push ( dialog ) ;
0 commit comments