@@ -38,6 +38,10 @@ export class ExtensionRunningLocationTracker {
38
38
@IExtensionManifestPropertiesService private readonly _extensionManifestPropertiesService : IExtensionManifestPropertiesService ,
39
39
) { }
40
40
41
+ public set ( extensionId : ExtensionIdentifier , runningLocation : ExtensionRunningLocation ) {
42
+ this . _runningLocation . set ( extensionId , runningLocation ) ;
43
+ }
44
+
41
45
public readExtensionKinds ( extensionDescription : IExtensionDescription ) : ExtensionKind [ ] {
42
46
if ( extensionDescription . isUnderDevelopment && this . _environmentService . extensionDevelopmentKind ) {
43
47
return this . _environmentService . extensionDevelopmentKind ;
@@ -196,10 +200,14 @@ export class ExtensionRunningLocationTracker {
196
200
}
197
201
198
202
public computeRunningLocation ( localExtensions : IExtensionDescription [ ] , remoteExtensions : IExtensionDescription [ ] , isInitialAllocation : boolean ) : ExtensionIdentifierMap < ExtensionRunningLocation | null > {
199
- return this . _doComputeRunningLocation ( localExtensions , remoteExtensions , isInitialAllocation ) . runningLocation ;
203
+ return this . _doComputeRunningLocation ( this . _runningLocation , localExtensions , remoteExtensions , isInitialAllocation ) . runningLocation ;
200
204
}
201
205
202
- private _doComputeRunningLocation ( localExtensions : IExtensionDescription [ ] , remoteExtensions : IExtensionDescription [ ] , isInitialAllocation : boolean ) : { runningLocation : ExtensionIdentifierMap < ExtensionRunningLocation | null > ; maxLocalProcessAffinity : number ; maxLocalWebWorkerAffinity : number } {
206
+ private _doComputeRunningLocation ( existingRunningLocation : ExtensionIdentifierMap < ExtensionRunningLocation | null > , localExtensions : IExtensionDescription [ ] , remoteExtensions : IExtensionDescription [ ] , isInitialAllocation : boolean ) : { runningLocation : ExtensionIdentifierMap < ExtensionRunningLocation | null > ; maxLocalProcessAffinity : number ; maxLocalWebWorkerAffinity : number } {
207
+ // Skip extensions that have an existing running location
208
+ localExtensions = localExtensions . filter ( extension => ! existingRunningLocation . has ( extension . identifier ) ) ;
209
+ remoteExtensions = remoteExtensions . filter ( extension => ! existingRunningLocation . has ( extension . identifier ) ) ;
210
+
203
211
const extensionHostKinds = determineExtensionHostKinds (
204
212
localExtensions ,
205
213
remoteExtensions ,
@@ -247,11 +255,18 @@ export class ExtensionRunningLocationTracker {
247
255
result . set ( extension . identifier , new LocalWebWorkerRunningLocation ( affinity ) ) ;
248
256
}
249
257
258
+ // Add extensions that already have an existing running location
259
+ for ( const [ extensionIdKey , runningLocation ] of existingRunningLocation ) {
260
+ if ( runningLocation ) {
261
+ result . set ( extensionIdKey , runningLocation ) ;
262
+ }
263
+ }
264
+
250
265
return { runningLocation : result , maxLocalProcessAffinity : maxAffinity , maxLocalWebWorkerAffinity : maxLocalWebWorkerAffinity } ;
251
266
}
252
267
253
268
public initializeRunningLocation ( localExtensions : IExtensionDescription [ ] , remoteExtensions : IExtensionDescription [ ] ) : void {
254
- const { runningLocation, maxLocalProcessAffinity, maxLocalWebWorkerAffinity } = this . _doComputeRunningLocation ( localExtensions , remoteExtensions , true ) ;
269
+ const { runningLocation, maxLocalProcessAffinity, maxLocalWebWorkerAffinity } = this . _doComputeRunningLocation ( this . _runningLocation , localExtensions , remoteExtensions , true ) ;
255
270
this . _runningLocation = runningLocation ;
256
271
this . _maxLocalProcessAffinity = maxLocalProcessAffinity ;
257
272
this . _maxLocalWebWorkerAffinity = maxLocalWebWorkerAffinity ;
0 commit comments