mirror of
https://github.com/Microsoft/vscode
synced 2024-09-12 21:24:38 +00:00
parent
2fe839fd1d
commit
3f6190e030
|
@ -888,7 +888,7 @@ class CachedExtensionsScanner extends ExtensionsScanner {
|
|||
const cacheContents = await this.readExtensionCache(cacheFile);
|
||||
this.input = input;
|
||||
if (cacheContents && cacheContents.input && ExtensionScannerInput.equals(cacheContents.input, this.input)) {
|
||||
this.logService.debug('Using cached extensions scan result', input.location.toString());
|
||||
this.logService.debug('Using cached extensions scan result', input.type === ExtensionType.System ? 'system' : 'user', input.location.toString());
|
||||
this.cacheValidatorThrottler.trigger(() => this.validateCache());
|
||||
return cacheContents.result.map((extension) => {
|
||||
// revive URI object
|
||||
|
|
|
@ -492,6 +492,9 @@ export class ExtensionsScanner extends Disposable {
|
|||
private readonly _onExtract = this._register(new Emitter<URI>());
|
||||
readonly onExtract = this._onExtract.event;
|
||||
|
||||
private scanAllExtensionPromise: Promise<IScannedExtension[]> | undefined;
|
||||
private scanUserExtensionsPromise: Promise<IScannedExtension[]> | undefined;
|
||||
|
||||
constructor(
|
||||
private readonly beforeRemovingExtension: (e: ILocalExtension) => Promise<void>,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
|
@ -512,12 +515,18 @@ export class ExtensionsScanner extends Disposable {
|
|||
|
||||
async scanExtensions(type: ExtensionType | null, profileLocation: URI, productVersion: IProductVersion): Promise<ILocalExtension[]> {
|
||||
try {
|
||||
const userScanOptions: ScanOptions = { includeInvalid: true, profileLocation, productVersion };
|
||||
const userScanOptions: ScanOptions = { includeInvalid: true, useCache: true, profileLocation, productVersion };
|
||||
let scannedExtensions: IScannedExtension[] = [];
|
||||
if (type === null || type === ExtensionType.System) {
|
||||
scannedExtensions.push(...await this.extensionsScannerService.scanAllExtensions({ includeInvalid: true }, userScanOptions, false));
|
||||
if (!this.scanAllExtensionPromise) {
|
||||
this.scanAllExtensionPromise = this.extensionsScannerService.scanAllExtensions({ includeInvalid: true, useCache: true }, userScanOptions, false).finally(() => this.scanAllExtensionPromise = undefined);
|
||||
}
|
||||
scannedExtensions.push(...await this.scanAllExtensionPromise);
|
||||
} else if (type === ExtensionType.User) {
|
||||
scannedExtensions.push(...await this.extensionsScannerService.scanUserExtensions(userScanOptions));
|
||||
if (!this.scanUserExtensionsPromise) {
|
||||
this.scanUserExtensionsPromise = this.extensionsScannerService.scanUserExtensions(userScanOptions).finally(() => this.scanUserExtensionsPromise = undefined);
|
||||
}
|
||||
scannedExtensions.push(...await this.scanUserExtensionsPromise);
|
||||
}
|
||||
scannedExtensions = type !== null ? scannedExtensions.filter(r => r.type === type) : scannedExtensions;
|
||||
return await Promise.all(scannedExtensions.map(extension => this.toLocalExtension(extension)));
|
||||
|
|
Loading…
Reference in a new issue