Skip to content

Commit a989a2d

Browse files
Add logs
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 7133e3d commit a989a2d

17 files changed

Lines changed: 80 additions & 3 deletions

code/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
617617
// filter out known extensions
618618
const ids = dependenciesAndPackExtensions.filter(id => knownIdentifiers.every(galleryIdentifier => !areSameExtensions(galleryIdentifier, { id })));
619619
if (ids.length) {
620+
console.info('//// BEFORE 1111 getExtensions ');
620621
const galleryExtensions = await this.galleryService.getExtensions(ids.map(id => ({ id, preRelease: preferPreRelease })), CancellationToken.None);
621622
for (const galleryExtension of galleryExtensions) {
622623
if (knownIdentifiers.find(identifier => areSameExtensions(identifier, galleryExtension.identifier))) {
@@ -647,15 +648,19 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
647648

648649
private async checkAndGetCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, installPreRelease: boolean, productVersion: IProductVersion): Promise<{ extension: IGalleryExtension; manifest: IExtensionManifest }> {
649650
let compatibleExtension: IGalleryExtension | null;
651+
console.info('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion ');
650652

651653
const extensionsControlManifest = await this.getExtensionsControlManifest();
652654
if (isMalicious(extension.identifier, extensionsControlManifest.malicious)) {
655+
console.info('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// isMalicious = throw');
653656
throw new ExtensionManagementError(nls.localize('malicious extension', "Can't install '{0}' extension since it was reported to be problematic.", extension.identifier.id), ExtensionManagementErrorCode.Malicious);
654657
}
655658

656659
const deprecationInfo = extensionsControlManifest.deprecated[extension.identifier.id.toLowerCase()];
657660
if (deprecationInfo?.extension?.autoMigrate) {
661+
console.info('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// autoMigrate ');
658662
this.logService.info(`The '${extension.identifier.id}' extension is deprecated, fetching the compatible '${deprecationInfo.extension.id}' extension instead.`);
663+
console.info('//// BEFORE 2222 getExtensions ');
659664
compatibleExtension = (await this.galleryService.getExtensions([{ id: deprecationInfo.extension.id, preRelease: deprecationInfo.extension.preRelease }], { targetPlatform: await this.getTargetPlatform(), compatible: true, productVersion }, CancellationToken.None))[0];
660665
if (!compatibleExtension) {
661666
throw new ExtensionManagementError(nls.localize('notFoundDeprecatedReplacementExtension', "Can't install '{0}' extension since it was deprecated and the replacement extension '{1}' can't be found.", extension.identifier.id, deprecationInfo.extension.id), ExtensionManagementErrorCode.Deprecated);
@@ -664,53 +669,68 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
664669

665670
else {
666671
if (await this.canInstall(extension) !== true) {
672+
console.info('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// can NOT install');
667673
const targetPlatform = await this.getTargetPlatform();
668674
throw new ExtensionManagementError(nls.localize('incompatible platform', "The '{0}' extension is not available in {1} for the {2}.", extension.identifier.id, this.productService.nameLong, TargetPlatformToString(targetPlatform)), ExtensionManagementErrorCode.IncompatibleTargetPlatform);
669675
}
670676

671677
compatibleExtension = await this.getCompatibleVersion(extension, sameVersion, installPreRelease, productVersion);
672678
if (!compatibleExtension) {
679+
console.info('//// abstractExtensionManagementService.ts /// not compatible ');
673680
const incompatibleApiProposalsMessages: string[] = [];
674681
if (!areApiProposalsCompatible(extension.properties.enabledApiProposals ?? [], incompatibleApiProposalsMessages)) {
682+
console.info('//// abstractExtensionManagementService.ts /// not compatible /// throw new ExtensionManagementError ');
675683
throw new ExtensionManagementError(nls.localize('incompatibleAPI', "Can't install '{0}' extension. {1}", extension.displayName ?? extension.identifier.id, incompatibleApiProposalsMessages[0]), ExtensionManagementErrorCode.IncompatibleApi);
676684
}
677685
/** If no compatible release version is found, check if the extension has a release version or not and throw relevant error */
686+
console.info('//// abstractExtensionManagementService.ts /// BEFORE 333 getExtensions ');
678687
if (!installPreRelease && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion && (await this.galleryService.getExtensions([extension.identifier], CancellationToken.None))[0]) {
679688
throw new ExtensionManagementError(nls.localize('notFoundReleaseExtension', "Can't install release version of '{0}' extension because it has no release version.", extension.displayName ?? extension.identifier.id), ExtensionManagementErrorCode.ReleaseVersionNotFound);
680689
}
681690
throw new ExtensionManagementError(nls.localize('notFoundCompatibleDependency', "Can't install '{0}' extension because it is not compatible with the current version of {1} (version {2}).", extension.identifier.id, this.productService.nameLong, this.productService.version), ExtensionManagementErrorCode.Incompatible);
691+
} else {
692+
console.info('//// abstractExtensionManagementService.ts /// DO compatible ');
682693
}
683694
}
684695

685696
this.logService.info('Getting Manifest...', compatibleExtension.identifier.id);
686697
const manifest = await this.galleryService.getManifest(compatibleExtension, CancellationToken.None);
687698
if (manifest === null) {
699+
console.info('//// abstractExtensionManagementService.ts /// manifest NULL ');
688700
throw new ExtensionManagementError(`Missing manifest for extension ${compatibleExtension.identifier.id}`, ExtensionManagementErrorCode.Invalid);
689701
}
690702

691703
if (manifest.version !== compatibleExtension.version) {
704+
console.info('//// abstractExtensionManagementService.ts /// manifest.version !== compatibleExtension.version ');
692705
throw new ExtensionManagementError(`Cannot install '${compatibleExtension.identifier.id}' extension because of version mismatch in Marketplace`, ExtensionManagementErrorCode.Invalid);
693706
}
694707

708+
console.info('//// abstractExtensionManagementService.ts /// RETURN EXTENSION ');
709+
695710
return { extension: compatibleExtension, manifest };
696711
}
697712

698713
protected async getCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, includePreRelease: boolean, productVersion: IProductVersion): Promise<IGalleryExtension | null> {
714+
console.info('//// abstractExtensionManagementService.ts //// getCompatibleVersion ');
699715
const targetPlatform = await this.getTargetPlatform();
700716
let compatibleExtension: IGalleryExtension | null = null;
701717

702718
if (!sameVersion && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion !== includePreRelease) {
719+
console.info('//// abstractExtensionManagementService.ts //// getCompatibleVersion BEFORE 444 getExtensions ');
703720
compatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, preRelease: includePreRelease }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
704721
}
705722

706723
if (!compatibleExtension && await this.galleryService.isExtensionCompatible(extension, includePreRelease, targetPlatform, productVersion)) {
724+
console.info('//// abstractExtensionManagementService.ts //// getCompatibleVersion /// isExtensionCompatible');
707725
compatibleExtension = extension;
708726
}
709727

710728
if (!compatibleExtension) {
711729
if (sameVersion) {
730+
console.info('//// abstractExtensionManagementService.ts //// getCompatibleVersion BEFORE 555 getExtensions ');
712731
compatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, version: extension.version }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
713732
} else {
733+
console.info('//// abstractExtensionManagementService.ts //// getCompatibleVersion ELSE BEFORE 555 getExtensions ');
714734
compatibleExtension = await this.galleryService.getCompatibleExtension(extension, includePreRelease, targetPlatform, productVersion);
715735
}
716736
}

code/src/vs/platform/extensionManagement/common/extensionGalleryManifestService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class ExtensionGalleryManifestService extends Disposable implements IExte
3535
}
3636

3737
async getExtensionGalleryManifest(): Promise<IExtensionGalleryManifest | null> {
38+
console.info('/////++++++ getExtensionGalleryManifest ');
3839
const extensionsGallery = this.productService.extensionsGallery as ExtensionGalleryConfig | undefined;
3940
if (!extensionsGallery?.serviceUrl) {
4041
return null;

code/src/vs/platform/extensionManagement/common/extensionGalleryService.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
586586
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, token: CancellationToken): Promise<IGalleryExtension[]>;
587587
async getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, arg1: any, arg2?: any): Promise<IGalleryExtension[]> {
588588
const extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
589+
console.info('///////////// ++++++ getExtensions ', extensionGalleryManifest);
589590
if (!extensionGalleryManifest) {
590591
throw new Error('No extension gallery service configured.');
591592
}
@@ -842,15 +843,20 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
842843
}
843844

844845
async getCompatibleExtension(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion: IProductVersion = { version: this.productService.version, date: this.productService.date }): Promise<IGalleryExtension | null> {
846+
console.info('//// extensionGalleryService.ts /// getCompatibleExtension ');
845847
if (isNotWebExtensionInWebTargetPlatform(extension.allTargetPlatforms, targetPlatform)) {
848+
console.info('//// extensionGalleryService.ts /// isNotWebExtensionInWebTargetPlatform ');
846849
return null;
847850
}
848851
if (await this.isExtensionCompatible(extension, includePreRelease, targetPlatform)) {
852+
console.info('//// extensionGalleryService.ts /// isExtensionCompatible ');
849853
return extension;
850854
}
851855
if (this.allowedExtensionsService.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName }) !== true) {
856+
console.info('//// extensionGalleryService.ts /// allowedExtensionsService.isAllowed ');
852857
return null;
853858
}
859+
console.info('//// extensionGalleryService.ts /// BEFORE 666 getExtensions ');
854860
const result = await this.getExtensions([{
855861
...extension.identifier,
856862
preRelease: includePreRelease,
@@ -861,6 +867,11 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
861867
queryAllVersions: true,
862868
targetPlatform,
863869
}, CancellationToken.None);
870+
if (result[0]) {
871+
console.info('//// extensionGalleryService.ts /// RESULT ');
872+
} else {
873+
console.info('//// extensionGalleryService.ts /// NOT RESULT ');
874+
}
864875

865876
return result[0] ?? null;
866877
}
@@ -988,6 +999,7 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
988999

9891000
async query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>> {
9901001
const extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
1002+
console.info('///////////// ++++++ query ', extensionGalleryManifest);
9911003

9921004
if (!extensionGalleryManifest) {
9931005
throw new Error('No extension gallery service configured.');
@@ -1524,6 +1536,7 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
15241536

15251537
async reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> {
15261538
const manifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
1539+
console.info('///////////// ++++++ report ', manifest);
15271540
if (!manifest) {
15281541
return undefined;
15291542
}
@@ -1663,6 +1676,7 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
16631676

16641677
private async getVersions(extensionIdentifier: IExtensionIdentifier, onlyCompatible?: { version: VersionKind; targetPlatform: TargetPlatform }): Promise<IGalleryExtensionVersion[]> {
16651678
const extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
1679+
console.info('///////////// ++++++ get versions ', extensionGalleryManifest);
16661680
if (!extensionGalleryManifest) {
16671681
throw new Error('No extension gallery service configured.');
16681682
}

code/src/vs/platform/extensionManagement/common/extensionManagementCLI.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export class ExtensionManagementCLI {
138138
}
139139

140140
this.logger.trace(localize({ key: 'updateExtensionsQuery', comment: ['Placeholder is for the count of extensions'] }, "Fetching latest versions for {0} extensions", installedExtensionsQuery.length));
141+
console.info('//// BEFORE 777 getExtensions ');
141142
const availableVersions = await this.extensionGalleryService.getExtensions(installedExtensionsQuery, { compatible: true }, CancellationToken.None);
142143

143144
const extensionsToUpdate: InstallExtensionInfo[] = [];
@@ -280,6 +281,7 @@ export class ExtensionManagementCLI {
280281
}
281282
}
282283
if (extensionInfos.length) {
284+
console.info('//// BEFORE 888 getExtensions ');
283285
const result = await this.extensionGalleryService.getExtensions(extensionInfos, { targetPlatform }, CancellationToken.None);
284286
for (const extension of result) {
285287
galleryExtensions.set(extension.identifier.id.toLowerCase(), extension);

code/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export async function migrateUnsupportedExtensions(extensionManagementService: I
3838
continue;
3939
}
4040

41+
console.info('//// BEFORE 999 getExtensions ');
4142
const gallery = (await galleryService.getExtensions([{ id: preReleaseExtensionId, preRelease }], { targetPlatform: await extensionManagementService.getTargetPlatform(), compatible: true }, CancellationToken.None))[0];
4243
if (!gallery) {
4344
logService.info(`Skipping migrating '${unsupportedExtension.identifier.id}' extension because, the comaptible target '${preReleaseExtensionId}' extension is not found`);

code/src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
344344
verifySignature = isBoolean(value) ? value : true;
345345
}
346346
const { location, verificationStatus } = await this.extensionsDownloader.download(extension, operation, verifySignature, clientTargetPlatform);
347-
const shouldRequireSignature = shouldRequireRepositorySignatureFor(extension.private, await this.extensionGalleryManifestService.getExtensionGalleryManifest());
347+
const manifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
348+
console.info('///////////// ++++++ downloadExtension ', manifest);
349+
const shouldRequireSignature = shouldRequireRepositorySignatureFor(extension.private, manifest);
348350

349351
if (
350352
verificationStatus !== ExtensionSignatureVerificationCode.Success
@@ -1155,8 +1157,10 @@ class InstallExtensionInProfileTask extends AbstractExtensionTask<ILocalExtensio
11551157

11561158
private async updateMetadata(extension: ILocalExtension, token: CancellationToken): Promise<void> {
11571159
try {
1160+
console.info('//// BEFORE 10 getExtensions ');
11581161
let [galleryExtension] = await this.galleryService.getExtensions([{ id: extension.identifier.id, version: extension.manifest.version }], token);
11591162
if (!galleryExtension) {
1163+
console.info('//// BEFORE 11 getExtensions ');
11601164
[galleryExtension] = await this.galleryService.getExtensions([{ id: extension.identifier.id }], token);
11611165
}
11621166
if (galleryExtension) {

code/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ export abstract class AbstractExtensionResourceLoaderService extends Disposable
108108

109109
public async getExtensionGalleryResourceURL({ publisher, name, version, targetPlatform }: { publisher: string; name: string; version: string; targetPlatform?: TargetPlatform }, path?: string): Promise<URI | undefined> {
110110
await this._initPromise;
111+
console.info('+++++++++++ getExtensionGalleryResourceURL ');
111112
if (this._extensionGalleryResourceUrlTemplate) {
113+
console.info('+++ getExtensionGalleryResourceURL +++ this._extensionGalleryResourceUrlTemplate ', this._extensionGalleryResourceUrlTemplate);
112114
const uri = URI.parse(format2(this._extensionGalleryResourceUrlTemplate, {
113115
publisher,
114116
name,
@@ -121,6 +123,8 @@ export abstract class AbstractExtensionResourceLoaderService extends Disposable
121123
path: 'extension'
122124
}));
123125
return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
126+
} else {
127+
console.info('+++ getExtensionGalleryResourceURL +++ NO this._extensionGalleryResourceUrlTemplate ');
124128
}
125129
return undefined;
126130
}

code/src/vs/platform/userDataSync/common/extensionsSync.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ export class LocalExtensionsProvider {
445445

446446
// User Extension Sync: Install/Update, Enablement & State
447447
const version = e.pinned ? e.version : undefined;
448+
console.info('//// BEFORE 12 getExtensions ');
448449
const extension = (await this.extensionGalleryService.getExtensions([{ ...e.identifier, version, preRelease: version ? undefined : e.preRelease }], CancellationToken.None))[0];
449450

450451
/* Update extension state only if

code/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ export class ExtensionEditor extends EditorPane {
520520
if (!preRelease && !extension.hasReleaseVersion) {
521521
return null;
522522
}
523+
console.info('//// BEFORE 13 getExtensions ');
523524
return (await this.extensionGalleryService.getExtensions([{ ...extension.identifier, preRelease, hasPreRelease: extension.hasPreReleaseVersion }], CancellationToken.None))[0] || null;
524525
}
525526

code/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ CommandsRegistry.registerCommand({
397397
const [id, version] = getIdAndVersion(arg);
398398
const extension = extensionsWorkbenchService.local.find(e => areSameExtensions(e.identifier, { id, uuid: version }));
399399
if (extension?.enablementState === EnablementState.DisabledByExtensionKind) {
400+
console.info('===== 11111 extensionGalleryService.getExtensions');
400401
const [gallery] = await extensionGalleryService.getExtensions([{ id, preRelease: options?.installPreReleaseVersion }], CancellationToken.None);
401402
if (!gallery) {
402403
throw new Error(localize('notFound', "Extension '{0}' not found.", arg));

0 commit comments

Comments
 (0)