Skip to content

Commit

Permalink
Fix bugs blocking extension upgrade (#25825)
Browse files Browse the repository at this point in the history
  • Loading branch information
kburtram committed Aug 13, 2024
1 parent 6e6d22d commit 32cadce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,14 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi

if (compatible) {
try {
// {{SQL CARBON EDIT}} - fix the version checks to use VSCode & ADS values
const engine = await this.getEngine(rawGalleryExtensionVersion);
if (!isEngineValid(engine, this.productService.version, this.productService.date)) {
if (!isEngineValid(engine, this.productService.vscodeVersion, this.productService.date)) {
return false;
}

const adsEngine = await this.getAzureDataStudioEngine(rawGalleryExtensionVersion);
if (!isEngineValid(adsEngine, this.productService.version, this.productService.date)) {
return false;
}
} catch (error) {
Expand Down Expand Up @@ -1373,6 +1379,18 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
return engine;
}

private async getAzureDataStudioEngine(rawExtensionVersion: IRawGalleryExtensionVersion): Promise<string> {
let engine = getAzureDataStudioEngine(rawExtensionVersion);
if (!engine) {
const manifest = await this.getManifestFromRawExtensionVersion(rawExtensionVersion, CancellationToken.None);
if (!manifest) {
throw new Error('Manifest was not found');
}
engine = manifest.engines.azdata;
}
return engine;
}

// private async getLastValidExtensionVersionRecursively(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion | null> {
// if (!versions.length) {
// return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { arch } from 'vs/base/common/process';
import { TelemetryTrustedValue } from 'vs/platform/telemetry/common/telemetryUtils';

export function areSameExtensions(a: IExtensionIdentifier, b: IExtensionIdentifier): boolean {
if (a.uuid && b.uuid) {
return a.uuid === b.uuid;
}
// {{SQL CARBON EDIT}} - Bug in extension gallery metadata breaks this assumption
// {{SQL CARBON EDIT}} - Specifically, Copilot 1.82.15 has incorrect ID in package.json
// if (a.uuid && b.uuid) {
// return a.uuid === b.uuid;
// }
if (a.id === b.id) {
return true;
}
Expand Down

0 comments on commit 32cadce

Please sign in to comment.