mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
Fix/use sqlops engine version (#1011)
* using sqlops as engine version instead of vscode
This commit is contained in:
@@ -105,7 +105,8 @@ export interface IExtensionManifest {
|
||||
name: string;
|
||||
publisher: string;
|
||||
version: string;
|
||||
engines: { vscode: string };
|
||||
// {{SQL CARBON EDIT}}
|
||||
engines: { vscode: string; sqlops?: string };
|
||||
displayName?: string;
|
||||
description?: string;
|
||||
main?: string;
|
||||
|
||||
@@ -263,8 +263,6 @@ function getVersionAsset(version: IRawGalleryExtensionVersion, type: string): IG
|
||||
fallbackUri: `${version.fallbackAssetUri}/${type}`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getDependencies(version: IRawGalleryExtensionVersion): string[] {
|
||||
@@ -453,11 +451,11 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
if (query.criteria) {
|
||||
const ids = query.criteria.filter(x => x.filterType === FilterType.ExtensionId).map(v => v.value.toLocaleLowerCase());
|
||||
if (ids && ids.length > 0) {
|
||||
filteredExtensions = filteredExtensions.filter(e => e.extensionId && ids.includes(e.extensionId.toLocaleLowerCase()));
|
||||
filteredExtensions = filteredExtensions.filter(e => e.extensionId && ids.includes(e.extensionId.toLocaleLowerCase()));
|
||||
}
|
||||
const names = query.criteria.filter(x => x.filterType === FilterType.ExtensionName).map(v => v.value.toLocaleLowerCase());
|
||||
if (names && names.length > 0) {
|
||||
filteredExtensions = filteredExtensions.filter(e => e.extensionName && e.publisher.publisherName && names.includes(`${e.publisher.publisherName.toLocaleLowerCase()}.${e.extensionName.toLocaleLowerCase()}`));
|
||||
filteredExtensions = filteredExtensions.filter(e => e.extensionName && e.publisher.publisherName && names.includes(`${e.publisher.publisherName.toLocaleLowerCase()}.${e.extensionName.toLocaleLowerCase()}`));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,14 +746,17 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
return this.getAsset(asset, { headers })
|
||||
.then(context => asJson<IExtensionManifest>(context))
|
||||
.then(manifest => {
|
||||
const engine = manifest.engines.vscode;
|
||||
if (manifest.engines && !manifest.engines.sqlops) {
|
||||
manifest.engines.sqlops = '*';
|
||||
}
|
||||
const engine = manifest.engines.sqlops;
|
||||
|
||||
if (!this.isEngineValid(engine)) {
|
||||
return this.getLastValidExtensionVersionReccursively(extension, versions.slice(1));
|
||||
}
|
||||
|
||||
version.properties = version.properties || [];
|
||||
version.properties.push({ key: PropertyType.Engine, value: manifest.engines.vscode });
|
||||
version.properties.push({ key: PropertyType.Engine, value: manifest.engines.sqlops });
|
||||
return version;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface IExtensionDescription {
|
||||
readonly activationEvents?: string[];
|
||||
readonly engines: {
|
||||
vscode: string;
|
||||
// {{SQL CARBON EDIT}}
|
||||
sqlops?: string;
|
||||
};
|
||||
readonly main?: string;
|
||||
readonly contributes?: { [point: string]: any; };
|
||||
|
||||
@@ -208,6 +208,8 @@ export interface IReducedExtensionDescription {
|
||||
isBuiltin: boolean;
|
||||
engines: {
|
||||
vscode: string;
|
||||
// {{SQL CARBON EDIT}}
|
||||
sqlops?: string;
|
||||
};
|
||||
main?: string;
|
||||
}
|
||||
@@ -219,7 +221,8 @@ export function isValidExtensionVersion(version: string, extensionDesc: IReduced
|
||||
return true;
|
||||
}
|
||||
|
||||
return isVersionValid(version, extensionDesc.engines.vscode, notices);
|
||||
// {{SQL CARBON EDIT}}
|
||||
return (extensionDesc.engines.sqlops && extensionDesc.engines.sqlops === '*') || isVersionValid(version, extensionDesc.engines.sqlops, notices);
|
||||
}
|
||||
|
||||
export function isVersionValid(currentVersion: string, requestedVersion: string, notices: string[] = []): boolean {
|
||||
@@ -289,8 +292,8 @@ function baseIsValidExtensionDescription(extensionFolderPath: string, extensionD
|
||||
notices.push(nls.localize('extensionDescription.engines', "property `{0}` is mandatory and must be of type `object`", 'engines'));
|
||||
return false;
|
||||
}
|
||||
if (typeof extensionDescription.engines.vscode !== 'string') {
|
||||
notices.push(nls.localize('extensionDescription.engines.vscode', "property `{0}` is mandatory and must be of type `string`", 'engines.vscode'));
|
||||
if (typeof extensionDescription.engines.sqlops !== 'string') {
|
||||
notices.push(nls.localize('extensionDescription.engines.sqlops', "property `{0}` is mandatory and must be of type `string`", 'engines.sqlops'));
|
||||
return false;
|
||||
}
|
||||
if (typeof extensionDescription.extensionDependencies !== 'undefined') {
|
||||
|
||||
@@ -58,6 +58,10 @@ class ExtensionManifestParser extends ExtensionManifestHandler {
|
||||
if (manifest.__metadata) {
|
||||
manifest.uuid = manifest.__metadata.id;
|
||||
}
|
||||
// {{SQL CARBON EDIT}}
|
||||
if (manifest.engines && !manifest.engines.sqlops) {
|
||||
manifest.engines.sqlops = '*';
|
||||
}
|
||||
delete manifest.__metadata;
|
||||
return manifest;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user