File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,15 @@ export function registerPatchesCommands(
115
115
vscode . commands . registerCommand (
116
116
`${ commandPrefix } .patches.remove` ,
117
117
async ( patchTreeItem : Patch ) => {
118
- await vscode . workspace . fs . delete ( patchTreeItem . resourceUri ) ;
119
- await removePatch ( patchTreeItem . resourceUri ) ;
120
-
121
- patchesProvider . refresh ( ) ;
118
+ await vscode . window . withProgress (
119
+ { location : { viewId : viewIds . PATCHES } } ,
120
+ async ( ) => {
121
+ await Promise . all ( [
122
+ vscode . workspace . fs . delete ( patchTreeItem . resourceUri ) ,
123
+ removePatch ( patchTreeItem . resourceUri ) ,
124
+ ] ) ;
125
+ } ,
126
+ ) ;
122
127
} ,
123
128
) ,
124
129
vscode . commands . registerCommand (
Original file line number Diff line number Diff line change @@ -403,6 +403,7 @@ export async function activate(context: vscode.ExtensionContext) {
403
403
404
404
const patchesConfig = getPatchesConfigFile ( electronRoot ) ;
405
405
const patchesProvider = new ElectronPatchesProvider (
406
+ context ,
406
407
electronRoot ,
407
408
patchesConfig ,
408
409
) ;
Original file line number Diff line number Diff line change @@ -53,11 +53,26 @@ export class ElectronPatchesProvider
53
53
private readonly rootDirectory : vscode . Uri ;
54
54
private readonly viewPullRequestTreeItem : ViewPullRequestPatchTreeItem ;
55
55
56
- constructor ( _electronRoot : vscode . Uri , patchesConfig : vscode . Uri ) {
56
+ constructor (
57
+ context : vscode . ExtensionContext ,
58
+ _electronRoot : vscode . Uri ,
59
+ patchesConfig : vscode . Uri ,
60
+ ) {
57
61
this . rootDirectory = vscode . Uri . joinPath ( _electronRoot , ".." , ".." ) ;
58
62
this . patchesConfig = parsePatchConfig ( patchesConfig ) ;
59
63
60
64
this . viewPullRequestTreeItem = new ViewPullRequestPatchTreeItem ( ) ;
65
+
66
+ const fsWatcher = vscode . workspace . createFileSystemWatcher (
67
+ new vscode . RelativePattern ( _electronRoot , "patches/**" ) ,
68
+ ) ;
69
+
70
+ context . subscriptions . push (
71
+ fsWatcher ,
72
+ fsWatcher . onDidChange ( ( ) => this . refresh ( ) ) ,
73
+ fsWatcher . onDidCreate ( ( ) => this . refresh ( ) ) ,
74
+ fsWatcher . onDidDelete ( ( ) => this . refresh ( ) ) ,
75
+ ) ;
61
76
}
62
77
63
78
refresh ( ) : void {
You can’t perform that action at this time.
0 commit comments