From f12a854ea73a2bd140c81816a41aee18f819941e Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Thu, 11 Jul 2024 11:34:24 +0200 Subject: [PATCH] Fix plugin version comparison (#13907) --- dev-packages/ovsx-client/src/ovsx-api-filter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-packages/ovsx-client/src/ovsx-api-filter.ts b/dev-packages/ovsx-client/src/ovsx-api-filter.ts index 7b5e0bed3190a..33b1f197e2b1c 100644 --- a/dev-packages/ovsx-client/src/ovsx-api-filter.ts +++ b/dev-packages/ovsx-client/src/ovsx-api-filter.ts @@ -90,7 +90,7 @@ export class OVSXApiFilterImpl implements OVSXApiFilter { if (extensions.length === 0) { return; } else if (this.isBuiltinNamespace(extensions[0].namespace.toLowerCase())) { - return extensions.find(extension => this.versionGreaterThanOrEqualTo(extension.version, this.supportedApiVersion)); + return extensions.find(extension => this.versionGreaterThanOrEqualTo(this.supportedApiVersion, extension.version)); } else { return extensions.find(extension => this.supportedVscodeApiSatisfies(extension.engines?.vscode ?? '*')); } @@ -108,7 +108,7 @@ export class OVSXApiFilterImpl implements OVSXApiFilter { } } if (this.isBuiltinNamespace(searchEntry.namespace)) { - return getLatestCompatibleVersion(allVersions => this.versionGreaterThanOrEqualTo(allVersions.version, this.supportedApiVersion)); + return getLatestCompatibleVersion(allVersions => this.versionGreaterThanOrEqualTo(this.supportedApiVersion, allVersions.version)); } else { return getLatestCompatibleVersion(allVersions => this.supportedVscodeApiSatisfies(allVersions.engines?.vscode ?? '*')); } @@ -127,7 +127,7 @@ export class OVSXApiFilterImpl implements OVSXApiFilter { if (!versionA || !versionB) { return false; } - return semver.lte(versionA, versionB); + return semver.gte(versionA, versionB); } protected supportedVscodeApiSatisfies(vscodeApiRange: string): boolean {