@@ -27,13 +27,14 @@ import { areSameExtensions, computeTargetPlatform, ExtensionKey, getExtensionId,
27
27
import { ExtensionType , ExtensionIdentifier , IExtensionManifest , TargetPlatform , IExtensionIdentifier , IRelaxedExtensionManifest , UNDEFINED_PUBLISHER , IExtensionDescription , BUILTIN_MANIFEST_CACHE_FILE , USER_MANIFEST_CACHE_FILE , MANIFEST_CACHE_FOLDER } from 'vs/platform/extensions/common/extensions' ;
28
28
import { validateExtensionManifest } from 'vs/platform/extensions/common/extensionValidator' ;
29
29
import { FileOperationResult , IFileService , toFileOperationResult } from 'vs/platform/files/common/files' ;
30
- import { createDecorator } from 'vs/platform/instantiation/common/instantiation' ;
30
+ import { createDecorator , IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
31
31
import { ILogService } from 'vs/platform/log/common/log' ;
32
32
import { IProductService } from 'vs/platform/product/common/productService' ;
33
33
import { Emitter , Event } from 'vs/base/common/event' ;
34
34
import { revive } from 'vs/base/common/marshalling' ;
35
35
import { IExtensionsProfileScannerService , IScannedProfileExtension } from 'vs/platform/extensionManagement/common/extensionsProfileScannerService' ;
36
36
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile' ;
37
+ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
37
38
38
39
export type IScannedExtensionManifest = IRelaxedExtensionManifest & { __metadata ?: Metadata } ;
39
40
@@ -139,9 +140,9 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
139
140
readonly onDidChangeCache = this . _onDidChangeCache . event ;
140
141
141
142
private readonly obsoleteFile = joinPath ( this . userExtensionsLocation , '.obsolete' ) ;
142
- private readonly systemExtensionsCachedScanner = this . _register ( new CachedExtensionsScanner ( joinPath ( this . cacheLocation , BUILTIN_MANIFEST_CACHE_FILE ) , this . obsoleteFile , this . extensionsProfileScannerService , this . fileService , this . logService ) ) ;
143
- private readonly userExtensionsCachedScanner = this . _register ( new CachedExtensionsScanner ( joinPath ( this . cacheLocation , USER_MANIFEST_CACHE_FILE ) , this . obsoleteFile , this . extensionsProfileScannerService , this . fileService , this . logService ) ) ;
144
- private readonly extensionsScanner = this . _register ( new ExtensionsScanner ( this . obsoleteFile , this . extensionsProfileScannerService , this . fileService , this . logService ) ) ;
143
+ private readonly systemExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , joinPath ( this . cacheLocation , BUILTIN_MANIFEST_CACHE_FILE ) , this . obsoleteFile ) ) ;
144
+ private readonly userExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , joinPath ( this . cacheLocation , USER_MANIFEST_CACHE_FILE ) , this . obsoleteFile ) ) ;
145
+ private readonly extensionsScanner = this . _register ( this . instantiationService . createInstance ( ExtensionsScanner , this . obsoleteFile ) ) ;
145
146
146
147
constructor (
147
148
readonly systemExtensionsLocation : URI ,
@@ -154,6 +155,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
154
155
@ILogService protected readonly logService : ILogService ,
155
156
@IEnvironmentService private readonly environmentService : IEnvironmentService ,
156
157
@IProductService private readonly productService : IProductService ,
158
+ @IInstantiationService private readonly instantiationService : IInstantiationService ,
157
159
) {
158
160
super ( ) ;
159
161
@@ -476,9 +478,10 @@ class ExtensionsScanner extends Disposable {
476
478
477
479
constructor (
478
480
private readonly obsoleteFile : URI ,
479
- protected readonly extensionsProfileScannerService : IExtensionsProfileScannerService ,
480
- protected readonly fileService : IFileService ,
481
- protected readonly logService : ILogService
481
+ @IExtensionsProfileScannerService protected readonly extensionsProfileScannerService : IExtensionsProfileScannerService ,
482
+ @IUriIdentityService protected readonly uriIdentityService : IUriIdentityService ,
483
+ @IFileService protected readonly fileService : IFileService ,
484
+ @ILogService protected readonly logService : ILogService
482
485
) {
483
486
super ( ) ;
484
487
}
@@ -518,15 +521,13 @@ class ExtensionsScanner extends Disposable {
518
521
}
519
522
520
523
private async scanExtensionsFromProfile ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
521
- const profileExtensions = await this . scanExtensionsFromProfileResource ( input . location , ( ) => true , input ) ;
522
- const applicationExtensions = await this . scanApplicationExtensions ( input ) ;
523
- return [ ...profileExtensions , ...applicationExtensions ] ;
524
- }
525
-
526
- private async scanApplicationExtensions ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
527
- return input . applicationExtensionslocation
528
- ? this . scanExtensionsFromProfileResource ( input . applicationExtensionslocation , ( e ) => ! ! e . metadata ?. isApplicationScoped , input )
529
- : [ ] ;
524
+ let profileExtensions = await this . scanExtensionsFromProfileResource ( input . location , ( ) => true , input ) ;
525
+ if ( input . applicationExtensionslocation && ! this . uriIdentityService . extUri . isEqual ( input . location , input . applicationExtensionslocation ) ) {
526
+ profileExtensions = profileExtensions . filter ( e => ! e . metadata ?. isApplicationScoped ) ;
527
+ const applicationExtensions = await this . scanExtensionsFromProfileResource ( input . applicationExtensionslocation , ( e ) => ! ! e . metadata ?. isApplicationScoped , input ) ;
528
+ profileExtensions . push ( ...applicationExtensions ) ;
529
+ }
530
+ return profileExtensions ;
530
531
}
531
532
532
533
private async scanExtensionsFromProfileResource ( profileResource : URI , filter : ( extensionInfo : IScannedProfileExtension ) => boolean , input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
@@ -845,11 +846,12 @@ class CachedExtensionsScanner extends ExtensionsScanner {
845
846
constructor (
846
847
private readonly cacheFile : URI ,
847
848
obsoleteFile : URI ,
848
- extensionsProfileScannerService : IExtensionsProfileScannerService ,
849
- fileService : IFileService ,
850
- logService : ILogService
849
+ @IExtensionsProfileScannerService extensionsProfileScannerService : IExtensionsProfileScannerService ,
850
+ @IUriIdentityService uriIdentityService : IUriIdentityService ,
851
+ @IFileService fileService : IFileService ,
852
+ @ILogService logService : ILogService
851
853
) {
852
- super ( obsoleteFile , extensionsProfileScannerService , fileService , logService ) ;
854
+ super ( obsoleteFile , extensionsProfileScannerService , uriIdentityService , fileService , logService ) ;
853
855
}
854
856
855
857
override async scanExtensions ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
@@ -947,13 +949,14 @@ export class NativeExtensionsScannerService extends AbstractExtensionsScannerSer
947
949
logService : ILogService ,
948
950
environmentService : IEnvironmentService ,
949
951
productService : IProductService ,
952
+ instantiationService : IInstantiationService ,
950
953
) {
951
954
super (
952
955
systemExtensionsLocation ,
953
956
userExtensionsLocation ,
954
957
joinPath ( userHome , '.vscode-oss-dev' , 'extensions' , 'control.json' ) ,
955
958
joinPath ( userDataPath , MANIFEST_CACHE_FOLDER ) ,
956
- userDataProfilesService , extensionsProfileScannerService , fileService , logService , environmentService , productService ) ;
959
+ userDataProfilesService , extensionsProfileScannerService , fileService , logService , environmentService , productService , instantiationService ) ;
957
960
this . translationsPromise = ( async ( ) => {
958
961
if ( platform . translationsConfigFile ) {
959
962
try {
0 commit comments