@@ -7,7 +7,6 @@ import { coalesce } from '../../../base/common/arrays.js';
7
7
import { ThrottledDelayer } from '../../../base/common/async.js' ;
8
8
import * as objects from '../../../base/common/objects.js' ;
9
9
import { VSBuffer } from '../../../base/common/buffer.js' ;
10
- import { IStringDictionary } from '../../../base/common/collections.js' ;
11
10
import { getErrorMessage } from '../../../base/common/errors.js' ;
12
11
import { getNodeType , parse , ParseError } from '../../../base/common/json.js' ;
13
12
import { getParseErrorMessage } from '../../../base/common/jsonErrorMessages.js' ;
@@ -18,12 +17,11 @@ import * as platform from '../../../base/common/platform.js';
18
17
import { basename , isEqual , joinPath } from '../../../base/common/resources.js' ;
19
18
import * as semver from '../../../base/common/semver/semver.js' ;
20
19
import Severity from '../../../base/common/severity.js' ;
21
- import { isEmptyObject } from '../../../base/common/types.js' ;
22
20
import { URI } from '../../../base/common/uri.js' ;
23
21
import { localize } from '../../../nls.js' ;
24
22
import { IEnvironmentService } from '../../environment/common/environment.js' ;
25
23
import { IProductVersion , Metadata } from './extensionManagement.js' ;
26
- import { areSameExtensions , computeTargetPlatform , ExtensionKey , getExtensionId , getGalleryExtensionId } from './extensionManagementUtil.js' ;
24
+ import { areSameExtensions , computeTargetPlatform , getExtensionId , getGalleryExtensionId } from './extensionManagementUtil.js' ;
27
25
import { ExtensionType , ExtensionIdentifier , IExtensionManifest , TargetPlatform , IExtensionIdentifier , IRelaxedExtensionManifest , UNDEFINED_PUBLISHER , IExtensionDescription , BUILTIN_MANIFEST_CACHE_FILE , USER_MANIFEST_CACHE_FILE , ExtensionIdentifierMap , parseEnabledApiProposalNames } from '../../extensions/common/extensions.js' ;
28
26
import { validateExtensionManifest } from '../../extensions/common/extensionValidator.js' ;
29
27
import { FileOperationResult , IFileService , toFileOperationResult } from '../../files/common/files.js' ;
@@ -106,7 +104,6 @@ export type ScanOptions = {
106
104
readonly profileLocation ?: URI ;
107
105
readonly includeInvalid ?: boolean ;
108
106
readonly includeAllVersions ?: boolean ;
109
- readonly includeUninstalled ?: boolean ;
110
107
readonly checkControlFile ?: boolean ;
111
108
readonly language ?: string ;
112
109
readonly useCache ?: boolean ;
@@ -145,10 +142,9 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
145
142
private readonly _onDidChangeCache = this . _register ( new Emitter < ExtensionType > ( ) ) ;
146
143
readonly onDidChangeCache = this . _onDidChangeCache . event ;
147
144
148
- private readonly obsoleteFile = joinPath ( this . userExtensionsLocation , '.obsolete' ) ;
149
- private readonly systemExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , this . currentProfile , this . obsoleteFile ) ) ;
150
- private readonly userExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , this . currentProfile , this . obsoleteFile ) ) ;
151
- private readonly extensionsScanner = this . _register ( this . instantiationService . createInstance ( ExtensionsScanner , this . obsoleteFile ) ) ;
145
+ private readonly systemExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , this . currentProfile ) ) ;
146
+ private readonly userExtensionsCachedScanner = this . _register ( this . instantiationService . createInstance ( CachedExtensionsScanner , this . currentProfile ) ) ;
147
+ private readonly extensionsScanner = this . _register ( this . instantiationService . createInstance ( ExtensionsScanner ) ) ;
152
148
153
149
constructor (
154
150
readonly systemExtensionsLocation : URI ,
@@ -199,8 +195,8 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
199
195
const location = scanOptions . profileLocation ?? this . userExtensionsLocation ;
200
196
this . logService . trace ( 'Started scanning user extensions' , location ) ;
201
197
const profileScanOptions : IProfileExtensionsScanOptions | undefined = this . uriIdentityService . extUri . isEqual ( scanOptions . profileLocation , this . userDataProfilesService . defaultProfile . extensionsResource ) ? { bailOutWhenFileNotFound : true } : undefined ;
202
- const extensionsScannerInput = await this . createExtensionScannerInput ( location , ! ! scanOptions . profileLocation , ExtensionType . User , ! scanOptions . includeUninstalled , scanOptions . language , true , profileScanOptions , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
203
- const extensionsScanner = scanOptions . useCache && ! extensionsScannerInput . devMode && extensionsScannerInput . excludeObsolete ? this . userExtensionsCachedScanner : this . extensionsScanner ;
198
+ const extensionsScannerInput = await this . createExtensionScannerInput ( location , ! ! scanOptions . profileLocation , ExtensionType . User , scanOptions . language , true , profileScanOptions , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
199
+ const extensionsScanner = scanOptions . useCache && ! extensionsScannerInput . devMode ? this . userExtensionsCachedScanner : this . extensionsScanner ;
204
200
let extensions : IRelaxedScannedExtension [ ] ;
205
201
try {
206
202
extensions = await extensionsScanner . scanExtensions ( extensionsScannerInput ) ;
@@ -221,7 +217,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
221
217
if ( this . environmentService . isExtensionDevelopment && this . environmentService . extensionDevelopmentLocationURI ) {
222
218
const extensions = ( await Promise . all ( this . environmentService . extensionDevelopmentLocationURI . filter ( extLoc => extLoc . scheme === Schemas . file )
223
219
. map ( async extensionDevelopmentLocationURI => {
224
- const input = await this . createExtensionScannerInput ( extensionDevelopmentLocationURI , false , ExtensionType . User , true , scanOptions . language , false /* do not validate */ , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
220
+ const input = await this . createExtensionScannerInput ( extensionDevelopmentLocationURI , false , ExtensionType . User , scanOptions . language , false /* do not validate */ , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
225
221
const extensions = await this . extensionsScanner . scanOneOrMultipleExtensions ( input ) ;
226
222
return extensions . map ( extension => {
227
223
// Override the extension type from the existing extensions
@@ -237,7 +233,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
237
233
}
238
234
239
235
async scanExistingExtension ( extensionLocation : URI , extensionType : ExtensionType , scanOptions : ScanOptions ) : Promise < IScannedExtension | null > {
240
- const extensionsScannerInput = await this . createExtensionScannerInput ( extensionLocation , false , extensionType , true , scanOptions . language , true , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
236
+ const extensionsScannerInput = await this . createExtensionScannerInput ( extensionLocation , false , extensionType , scanOptions . language , true , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
241
237
const extension = await this . extensionsScanner . scanExtension ( extensionsScannerInput ) ;
242
238
if ( ! extension ) {
243
239
return null ;
@@ -249,7 +245,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
249
245
}
250
246
251
247
async scanOneOrMultipleExtensions ( extensionLocation : URI , extensionType : ExtensionType , scanOptions : ScanOptions ) : Promise < IScannedExtension [ ] > {
252
- const extensionsScannerInput = await this . createExtensionScannerInput ( extensionLocation , false , extensionType , true , scanOptions . language , true , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
248
+ const extensionsScannerInput = await this . createExtensionScannerInput ( extensionLocation , false , extensionType , scanOptions . language , true , undefined , scanOptions . productVersion ?? this . getProductVersion ( ) ) ;
253
249
const extensions = await this . extensionsScanner . scanOneOrMultipleExtensions ( extensionsScannerInput ) ;
254
250
return this . applyScanOptions ( extensions , extensionType , scanOptions , true ) ;
255
251
}
@@ -405,7 +401,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
405
401
406
402
private async scanDefaultSystemExtensions ( useCache : boolean , language : string | undefined ) : Promise < IRelaxedScannedExtension [ ] > {
407
403
this . logService . trace ( 'Started scanning system extensions' ) ;
408
- const extensionsScannerInput = await this . createExtensionScannerInput ( this . systemExtensionsLocation , false , ExtensionType . System , true , language , true , undefined , this . getProductVersion ( ) ) ;
404
+ const extensionsScannerInput = await this . createExtensionScannerInput ( this . systemExtensionsLocation , false , ExtensionType . System , language , true , undefined , this . getProductVersion ( ) ) ;
409
405
const extensionsScanner = useCache && ! extensionsScannerInput . devMode ? this . systemExtensionsCachedScanner : this . extensionsScanner ;
410
406
const result = await extensionsScanner . scanExtensions ( extensionsScannerInput ) ;
411
407
this . logService . trace ( 'Scanned system extensions:' , result . length ) ;
@@ -435,7 +431,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
435
431
break ;
436
432
}
437
433
}
438
- const result = await Promise . all ( devSystemExtensionsLocations . map ( async location => this . extensionsScanner . scanExtension ( ( await this . createExtensionScannerInput ( location , false , ExtensionType . System , true , language , true , undefined , this . getProductVersion ( ) ) ) ) ) ) ;
434
+ const result = await Promise . all ( devSystemExtensionsLocations . map ( async location => this . extensionsScanner . scanExtension ( ( await this . createExtensionScannerInput ( location , false , ExtensionType . System , language , true , undefined , this . getProductVersion ( ) ) ) ) ) ) ;
439
435
this . logService . trace ( 'Scanned dev system extensions:' , result . length ) ;
440
436
return coalesce ( result ) ;
441
437
}
@@ -449,7 +445,7 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
449
445
}
450
446
}
451
447
452
- private async createExtensionScannerInput ( location : URI , profile : boolean , type : ExtensionType , excludeObsolete : boolean , language : string | undefined , validate : boolean , profileScanOptions : IProfileExtensionsScanOptions | undefined , productVersion : IProductVersion ) : Promise < ExtensionScannerInput > {
448
+ private async createExtensionScannerInput ( location : URI , profile : boolean , type : ExtensionType , language : string | undefined , validate : boolean , profileScanOptions : IProfileExtensionsScanOptions | undefined , productVersion : IProductVersion ) : Promise < ExtensionScannerInput > {
453
449
const translations = await this . getTranslations ( language ?? platform . language ) ;
454
450
const mtime = await this . getMtime ( location ) ;
455
451
const applicationExtensionsLocation = profile && ! this . uriIdentityService . extUri . isEqual ( location , this . userDataProfilesService . defaultProfile . extensionsResource ) ? this . userDataProfilesService . defaultProfile . extensionsResource : undefined ;
@@ -462,7 +458,6 @@ export abstract class AbstractExtensionsScannerService extends Disposable implem
462
458
profile ,
463
459
profileScanOptions ,
464
460
type ,
465
- excludeObsolete ,
466
461
validate ,
467
462
productVersion . version ,
468
463
productVersion . date ,
@@ -504,7 +499,6 @@ export class ExtensionScannerInput {
504
499
public readonly profile : boolean ,
505
500
public readonly profileScanOptions : IProfileExtensionsScanOptions | undefined ,
506
501
public readonly type : ExtensionType ,
507
- public readonly excludeObsolete : boolean ,
508
502
public readonly validate : boolean ,
509
503
public readonly productVersion : string ,
510
504
public readonly productDate : string | undefined ,
@@ -534,7 +528,6 @@ export class ExtensionScannerInput {
534
528
&& a . profile === b . profile
535
529
&& objects . equals ( a . profileScanOptions , b . profileScanOptions )
536
530
&& a . type === b . type
537
- && a . excludeObsolete === b . excludeObsolete
538
531
&& a . validate === b . validate
539
532
&& a . productVersion === b . productVersion
540
533
&& a . productDate === b . productDate
@@ -558,7 +551,6 @@ class ExtensionsScanner extends Disposable {
558
551
private readonly extensionsEnabledWithApiProposalVersion : string [ ] ;
559
552
560
553
constructor (
561
- private readonly obsoleteFile : URI ,
562
554
@IExtensionsProfileScannerService protected readonly extensionsProfileScannerService : IExtensionsProfileScannerService ,
563
555
@IUriIdentityService protected readonly uriIdentityService : IUriIdentityService ,
564
556
@IFileService protected readonly fileService : IFileService ,
@@ -571,15 +563,9 @@ class ExtensionsScanner extends Disposable {
571
563
}
572
564
573
565
async scanExtensions ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
574
- const extensions = input . profile ? await this . scanExtensionsFromProfile ( input ) : await this . scanExtensionsFromLocation ( input ) ;
575
- let obsolete : IStringDictionary < boolean > = { } ;
576
- if ( input . excludeObsolete && input . type === ExtensionType . User ) {
577
- try {
578
- const raw = ( await this . fileService . readFile ( this . obsoleteFile ) ) . value . toString ( ) ;
579
- obsolete = JSON . parse ( raw ) ;
580
- } catch ( error ) { /* ignore */ }
581
- }
582
- return isEmptyObject ( obsolete ) ? extensions : extensions . filter ( e => ! obsolete [ ExtensionKey . create ( e ) . toString ( ) ] ) ;
566
+ return input . profile
567
+ ? this . scanExtensionsFromProfile ( input )
568
+ : this . scanExtensionsFromLocation ( input ) ;
583
569
}
584
570
585
571
private async scanExtensionsFromLocation ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
@@ -596,7 +582,7 @@ class ExtensionsScanner extends Disposable {
596
582
if ( input . type === ExtensionType . User && basename ( c . resource ) . indexOf ( '.' ) === 0 ) {
597
583
return null ;
598
584
}
599
- const extensionScannerInput = new ExtensionScannerInput ( c . resource , input . mtime , input . applicationExtensionslocation , input . applicationExtensionslocationMtime , input . profile , input . profileScanOptions , input . type , input . excludeObsolete , input . validate , input . productVersion , input . productDate , input . productCommit , input . devMode , input . language , input . translations ) ;
585
+ const extensionScannerInput = new ExtensionScannerInput ( c . resource , input . mtime , input . applicationExtensionslocation , input . applicationExtensionslocationMtime , input . profile , input . profileScanOptions , input . type , input . validate , input . productVersion , input . productDate , input . productCommit , input . devMode , input . language , input . translations ) ;
600
586
return this . scanExtension ( extensionScannerInput ) ;
601
587
} ) ) ;
602
588
return coalesce ( extensions )
@@ -622,7 +608,7 @@ class ExtensionsScanner extends Disposable {
622
608
const extensions = await Promise . all < IRelaxedScannedExtension | null > (
623
609
scannedProfileExtensions . map ( async extensionInfo => {
624
610
if ( filter ( extensionInfo ) ) {
625
- const extensionScannerInput = new ExtensionScannerInput ( extensionInfo . location , input . mtime , input . applicationExtensionslocation , input . applicationExtensionslocationMtime , input . profile , input . profileScanOptions , input . type , input . excludeObsolete , input . validate , input . productVersion , input . productDate , input . productCommit , input . devMode , input . language , input . translations ) ;
611
+ const extensionScannerInput = new ExtensionScannerInput ( extensionInfo . location , input . mtime , input . applicationExtensionslocation , input . applicationExtensionslocationMtime , input . profile , input . profileScanOptions , input . type , input . validate , input . productVersion , input . productDate , input . productCommit , input . devMode , input . language , input . translations ) ;
626
612
return this . scanExtension ( extensionScannerInput , extensionInfo . metadata ) ;
627
613
}
628
614
return null ;
@@ -891,7 +877,6 @@ class CachedExtensionsScanner extends ExtensionsScanner {
891
877
892
878
constructor (
893
879
private readonly currentProfile : IUserDataProfile ,
894
- obsoleteFile : URI ,
895
880
@IUserDataProfilesService private readonly userDataProfilesService : IUserDataProfilesService ,
896
881
@IExtensionsProfileScannerService extensionsProfileScannerService : IExtensionsProfileScannerService ,
897
882
@IUriIdentityService uriIdentityService : IUriIdentityService ,
@@ -900,7 +885,7 @@ class CachedExtensionsScanner extends ExtensionsScanner {
900
885
@IEnvironmentService environmentService : IEnvironmentService ,
901
886
@ILogService logService : ILogService
902
887
) {
903
- super ( obsoleteFile , extensionsProfileScannerService , uriIdentityService , fileService , productService , environmentService , logService ) ;
888
+ super ( extensionsProfileScannerService , uriIdentityService , fileService , productService , environmentService , logService ) ;
904
889
}
905
890
906
891
override async scanExtensions ( input : ExtensionScannerInput ) : Promise < IRelaxedScannedExtension [ ] > {
0 commit comments