@@ -78,6 +78,7 @@ export namespace CommandIDs {
78
78
// Context menu commands
79
79
export const gitFileDiff = 'git:context-diff' ;
80
80
export const gitFileDiscard = 'git:context-discard' ;
81
+ export const gitFileDelete = 'git:context-delete' ;
81
82
export const gitFileOpen = 'git:context-open' ;
82
83
export const gitFileUnstage = 'git:context-unstage' ;
83
84
export const gitFileStage = 'git:context-stage' ;
@@ -478,6 +479,36 @@ export function addCommands(
478
479
}
479
480
} ) ;
480
481
482
+ commands . addCommand ( CommandIDs . gitFileDelete , {
483
+ label : 'Delete' ,
484
+ caption : 'Delete this file' ,
485
+ execute : async args => {
486
+ const file : Git . IStatusFile = args as any ;
487
+
488
+ const result = await showDialog ( {
489
+ title : 'Delete File' ,
490
+ body : (
491
+ < span >
492
+ Are you sure you want to permanently delete
493
+ < b > { file . to } </ b > ? This action cannot be undone.
494
+ </ span >
495
+ ) ,
496
+ buttons : [ Dialog . cancelButton ( ) , Dialog . warnButton ( { label : 'Delete' } ) ]
497
+ } ) ;
498
+ if ( result . button . accept ) {
499
+ try {
500
+ await app . commands . execute ( 'docmanager:delete-file' , {
501
+ path : model . getRelativeFilePath ( file . to )
502
+ } ) ;
503
+ } catch ( reason ) {
504
+ showErrorMessage ( `Deleting ${ file . to } failed.` , reason , [
505
+ Dialog . warnButton ( { label : 'DISMISS' } )
506
+ ] ) ;
507
+ }
508
+ }
509
+ }
510
+ } ) ;
511
+
481
512
commands . addCommand ( CommandIDs . gitFileDiscard , {
482
513
label : 'Discard' ,
483
514
caption : 'Discard recent changes of selected file' ,
0 commit comments