Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d

This commit is contained in:
ADS Merger
2020-06-30 04:40:21 +00:00
committed by AzureDataStudio
parent a8a7559229
commit 1388493cc1
602 changed files with 16375 additions and 12940 deletions

View File

@@ -339,6 +339,8 @@ function toExtension(galleryExtension: IRawGalleryExtension, version: IRawGaller
installCount: getStatistic(galleryExtension.statistics, 'install'),
rating: getStatistic(galleryExtension.statistics, 'averagerating'),
ratingCount: getStatistic(galleryExtension.statistics, 'ratingcount'),
assetUri: URI.parse(version.assetUri),
assetTypes: version.files.map(({ assetType }) => assetType),
assets,
properties: {
dependencies: getExtensions(version, PropertyType.Dependency),
@@ -769,7 +771,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
return Promise.resolve('');
}
getAllVersions(extension: IGalleryExtension, compatible: boolean): Promise<IGalleryExtensionVersion[]> {
async getAllVersions(extension: IGalleryExtension, compatible: boolean): Promise<IGalleryExtensionVersion[]> {
let query = new Query()
.withFlags(Flags.IncludeVersions, Flags.IncludeFiles, Flags.IncludeVersionProperties)
.withPage(1, 1)
@@ -781,19 +783,24 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
query = query.withFilter(FilterType.ExtensionName, extension.identifier.id);
}
return this.queryGallery(query, CancellationToken.None).then(({ galleryExtensions }) => {
if (galleryExtensions.length) {
if (compatible) {
return Promise.all(galleryExtensions[0].versions.map(v => this.getEngine(v).then(engine => isEngineValid(engine, this.productService.version) ? v : null)))
.then(versions => versions
.filter(v => !!v)
.map(v => ({ version: v!.version, date: v!.lastUpdated })));
} else {
return galleryExtensions[0].versions.map(v => ({ version: v.version, date: v.lastUpdated }));
}
const result: IGalleryExtensionVersion[] = [];
const { galleryExtensions } = await this.queryGallery(query, CancellationToken.None);
if (galleryExtensions.length) {
if (compatible) {
await Promise.all(galleryExtensions[0].versions.map(async v => {
let engine: string | undefined;
try {
engine = await this.getEngine(v);
} catch (error) { /* Ignore error and skip version */ }
if (engine && isEngineValid(engine, this.productService.version)) {
result.push({ version: v!.version, date: v!.lastUpdated });
}
}));
} else {
result.push(...galleryExtensions[0].versions.map(v => ({ version: v.version, date: v.lastUpdated })));
}
return [];
});
}
return result;
}
private getAsset(asset: IGalleryExtensionAsset, options: IRequestOptions = {}, token: CancellationToken = CancellationToken.None): Promise<IRequestContext> {

View File

@@ -82,6 +82,8 @@ export interface IGalleryExtension {
installCount: number;
rating: number;
ratingCount: number;
assetUri: URI;
assetTypes: string[];
assets: IGalleryExtensionAssets;
properties: IGalleryExtensionProperties;
telemetryData: any;
@@ -95,17 +97,11 @@ export interface IGalleryMetadata {
}
export interface ILocalExtension extends IExtension {
readonly manifest: IExtensionManifest;
isMachineScoped: boolean;
publisherId: string | null;
publisherDisplayName: string | null;
readmeUrl: URI | null;
changelogUrl: URI | null;
}
export const IExtensionManagementService = createDecorator<IExtensionManagementService>('extensionManagementService');
export const IExtensionGalleryService = createDecorator<IExtensionGalleryService>('extensionGalleryService');
export const enum SortBy {
NoneOrRelevance = 0,
LastUpdatedDate = 1,
@@ -152,6 +148,7 @@ export interface ITranslation {
contents: { [key: string]: {} };
}
export const IExtensionGalleryService = createDecorator<IExtensionGalleryService>('extensionGalleryService');
export interface IExtensionGalleryService {
readonly _serviceBrand: undefined;
isEnabled(): boolean;
@@ -199,6 +196,7 @@ export class ExtensionManagementError extends Error {
}
}
export const IExtensionManagementService = createDecorator<IExtensionManagementService>('extensionManagementService');
export interface IExtensionManagementService {
readonly _serviceBrand: undefined;

View File

@@ -228,9 +228,9 @@ export class ExtensionsScanner extends Disposable {
const children = await pfs.readdir(extensionPath);
const { manifest, metadata } = await this.readManifest(extensionPath);
const readme = children.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
const readmeUrl = readme ? URI.file(path.join(extensionPath, readme)) : null;
const readmeUrl = readme ? URI.file(path.join(extensionPath, readme)) : undefined;
const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
const changelogUrl = changelog ? URI.file(path.join(extensionPath, changelog)) : null;
const changelogUrl = changelog ? URI.file(path.join(extensionPath, changelog)) : undefined;
const identifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
const local = <ILocalExtension>{ type, identifier, manifest, location: URI.file(extensionPath), readmeUrl, changelogUrl, publisherDisplayName: null, publisherId: null, isMachineScoped: false };
if (metadata) {