Skip to content

Commit 3f111f5

Browse files
Add logs
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 4f95d36 commit 3f111f5

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,14 +648,17 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
648648

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

652653
const extensionsControlManifest = await this.getExtensionsControlManifest();
653654
if (isMalicious(extension.identifier, extensionsControlManifest.malicious)) {
655+
console.error('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// isMalicious = throw');
654656
throw new ExtensionManagementError(nls.localize('malicious extension', "Can't install '{0}' extension since it was reported to be problematic.", extension.identifier.id), ExtensionManagementErrorCode.Malicious);
655657
}
656658

657659
const deprecationInfo = extensionsControlManifest.deprecated[extension.identifier.id.toLowerCase()];
658660
if (deprecationInfo?.extension?.autoMigrate) {
661+
console.error('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// autoMigrate ');
659662
this.logService.info(`The '${extension.identifier.id}' extension is deprecated, fetching the compatible '${deprecationInfo.extension.id}' extension instead.`);
660663
console.error('//// BEFORE 2222 getExtensions ');
661664
compatibleExtension = (await this.galleryService.getExtensions([{ id: deprecationInfo.extension.id, preRelease: deprecationInfo.extension.preRelease }], { targetPlatform: await this.getTargetPlatform(), compatible: true, productVersion }, CancellationToken.None))[0];
@@ -666,56 +669,68 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
666669

667670
else {
668671
if (await this.canInstall(extension) !== true) {
672+
console.error('//// abstractExtensionManagementService.ts /// checkAndGetCompatibleVersion /// can NOT install');
669673
const targetPlatform = await this.getTargetPlatform();
670674
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);
671675
}
672676

673677
compatibleExtension = await this.getCompatibleVersion(extension, sameVersion, installPreRelease, productVersion);
674678
if (!compatibleExtension) {
679+
console.error('//// abstractExtensionManagementService.ts /// not compatible ');
675680
const incompatibleApiProposalsMessages: string[] = [];
676681
if (!areApiProposalsCompatible(extension.properties.enabledApiProposals ?? [], incompatibleApiProposalsMessages)) {
682+
console.error('//// abstractExtensionManagementService.ts /// not compatible /// throw new ExtensionManagementError ');
677683
throw new ExtensionManagementError(nls.localize('incompatibleAPI', "Can't install '{0}' extension. {1}", extension.displayName ?? extension.identifier.id, incompatibleApiProposalsMessages[0]), ExtensionManagementErrorCode.IncompatibleApi);
678684
}
679685
/** If no compatible release version is found, check if the extension has a release version or not and throw relevant error */
680-
console.error('//// BEFORE 333 getExtensions ');
686+
console.error('//// abstractExtensionManagementService.ts /// BEFORE 333 getExtensions ');
681687
if (!installPreRelease && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion && (await this.galleryService.getExtensions([extension.identifier], CancellationToken.None))[0]) {
682688
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);
683689
}
684690
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.error('//// abstractExtensionManagementService.ts /// DO compatible ');
685693
}
686694
}
687695

688696
this.logService.info('Getting Manifest...', compatibleExtension.identifier.id);
689697
const manifest = await this.galleryService.getManifest(compatibleExtension, CancellationToken.None);
690698
if (manifest === null) {
699+
console.error('//// abstractExtensionManagementService.ts /// manifest NULL ');
691700
throw new ExtensionManagementError(`Missing manifest for extension ${compatibleExtension.identifier.id}`, ExtensionManagementErrorCode.Invalid);
692701
}
693702

694703
if (manifest.version !== compatibleExtension.version) {
704+
console.error('//// abstractExtensionManagementService.ts /// manifest.version !== compatibleExtension.version ');
695705
throw new ExtensionManagementError(`Cannot install '${compatibleExtension.identifier.id}' extension because of version mismatch in Marketplace`, ExtensionManagementErrorCode.Invalid);
696706
}
697707

708+
console.error('//// abstractExtensionManagementService.ts /// RETURN EXTENSION ');
709+
698710
return { extension: compatibleExtension, manifest };
699711
}
700712

701713
protected async getCompatibleVersion(extension: IGalleryExtension, sameVersion: boolean, includePreRelease: boolean, productVersion: IProductVersion): Promise<IGalleryExtension | null> {
714+
console.error('//// abstractExtensionManagementService.ts //// getCompatibleVersion ');
702715
const targetPlatform = await this.getTargetPlatform();
703716
let compatibleExtension: IGalleryExtension | null = null;
704717

705718
if (!sameVersion && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion !== includePreRelease) {
706-
console.error('//// BEFORE 444 getExtensions ');
719+
console.error('//// abstractExtensionManagementService.ts //// getCompatibleVersion BEFORE 444 getExtensions ');
707720
compatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, preRelease: includePreRelease }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
708721
}
709722

710723
if (!compatibleExtension && await this.galleryService.isExtensionCompatible(extension, includePreRelease, targetPlatform, productVersion)) {
724+
console.error('//// abstractExtensionManagementService.ts //// getCompatibleVersion /// isExtensionCompatible');
711725
compatibleExtension = extension;
712726
}
713727

714728
if (!compatibleExtension) {
715729
if (sameVersion) {
716-
console.error('//// BEFORE 555 getExtensions ');
730+
console.error('//// abstractExtensionManagementService.ts //// getCompatibleVersion BEFORE 555 getExtensions ');
717731
compatibleExtension = (await this.galleryService.getExtensions([{ ...extension.identifier, version: extension.version }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
718732
} else {
733+
console.error('//// abstractExtensionManagementService.ts //// getCompatibleVersion ELSE BEFORE 555 getExtensions ');
719734
compatibleExtension = await this.galleryService.getCompatibleExtension(extension, includePreRelease, targetPlatform, productVersion);
720735
}
721736
}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,16 +843,20 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
843843
}
844844

845845
async getCompatibleExtension(extension: IGalleryExtension, includePreRelease: boolean, targetPlatform: TargetPlatform, productVersion: IProductVersion = { version: this.productService.version, date: this.productService.date }): Promise<IGalleryExtension | null> {
846+
console.error('//// extensionGalleryService.ts /// getCompatibleExtension ');
846847
if (isNotWebExtensionInWebTargetPlatform(extension.allTargetPlatforms, targetPlatform)) {
848+
console.error('//// extensionGalleryService.ts /// isNotWebExtensionInWebTargetPlatform ');
847849
return null;
848850
}
849851
if (await this.isExtensionCompatible(extension, includePreRelease, targetPlatform)) {
852+
console.error('//// extensionGalleryService.ts /// isExtensionCompatible ');
850853
return extension;
851854
}
852855
if (this.allowedExtensionsService.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName }) !== true) {
856+
console.error('//// extensionGalleryService.ts /// allowedExtensionsService.isAllowed ');
853857
return null;
854858
}
855-
console.error('//// BEFORE 666 getExtensions ');
859+
console.error('//// extensionGalleryService.ts /// BEFORE 666 getExtensions ');
856860
const result = await this.getExtensions([{
857861
...extension.identifier,
858862
preRelease: includePreRelease,
@@ -863,6 +867,11 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
863867
queryAllVersions: true,
864868
targetPlatform,
865869
}, CancellationToken.None);
870+
if (result[0]) {
871+
console.error('//// extensionGalleryService.ts /// RESULT ');
872+
} else {
873+
console.error('//// extensionGalleryService.ts /// NOT RESULT ');
874+
}
866875

867876
return result[0] ?? null;
868877
}

0 commit comments

Comments
 (0)