@@ -44,7 +44,7 @@ export class ExtensionsCleaner extends Disposable {
44
44
class ProfileExtensionsCleaner extends Disposable {
45
45
46
46
private profileExtensionsLocations = new Map < string , URI [ ] > ;
47
- private readonly initPromise : Promise < boolean > ;
47
+ private initPromise : Promise < boolean > ;
48
48
49
49
constructor (
50
50
@INativeServerExtensionManagementService private readonly extensionManagementService : INativeServerExtensionManagementService ,
@@ -62,6 +62,7 @@ class ProfileExtensionsCleaner extends Disposable {
62
62
}
63
63
64
64
private async initialize ( ) : Promise < boolean > {
65
+ this . profileExtensionsLocations . clear ( ) ;
65
66
if ( this . userDataProfilesService . profiles . length === 1 ) {
66
67
return true ;
67
68
}
@@ -80,12 +81,15 @@ class ProfileExtensionsCleaner extends Disposable {
80
81
}
81
82
}
82
83
83
- private async onDidChangeProfiles ( { added, removed } : DidChangeProfilesEvent ) : Promise < void > {
84
+ private async onDidChangeProfiles ( { added, removed, all } : DidChangeProfilesEvent ) : Promise < void > {
84
85
if ( ! ( await this . initPromise ) ) {
85
86
return ;
86
87
}
87
88
await Promise . all ( added . map ( profile => profile . extensionsResource ? this . populateExtensionsFromProfile ( profile . extensionsResource ) : Promise . resolve ( ) ) ) ;
88
89
await Promise . all ( removed . map ( profile => profile . extensionsResource ? this . removeExtensionsFromProfile ( profile . extensionsResource ) : Promise . resolve ( ) ) ) ;
90
+ if ( all . length === 1 ) {
91
+ this . initPromise = this . initialize ( ) ;
92
+ }
89
93
}
90
94
91
95
private async onDidInstallExtensions ( installedExtensions : readonly ServerInstallExtensionResult [ ] ) : Promise < void > {
0 commit comments