Skip to content

Commit

Permalink
#45663 Get all asset types
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed May 28, 2018
1 parent 4426eb7 commit 684b7e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export enum InstallOperation {
Update
}

export interface ITranslation {
contents: { [key: string]: {} };
}

export interface IExtensionGalleryService {
_serviceBrand: any;
isEnabled(): boolean;
Expand All @@ -263,7 +267,7 @@ export interface IExtensionGalleryService {
getReadme(extension: IGalleryExtension): TPromise<string>;
getManifest(extension: IGalleryExtension): TPromise<IExtensionManifest>;
getChangelog(extension: IGalleryExtension): TPromise<string>;
getCoreTranslations(extension: IGalleryExtension, languageId: string): TPromise<{}>;
getCoreTranslation(extension: IGalleryExtension, languageId: string): TPromise<ITranslation>;
loadCompatibleVersion(extension: IGalleryExtension): TPromise<IGalleryExtension>;
loadAllDependencies(dependencies: IExtensionIdentifier[]): TPromise<IGalleryExtension[]>;
getExtensionsReport(): TPromise<IReportedExtension[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import { TPromise } from 'vs/base/common/winjs.base';
import { distinct } from 'vs/base/common/arrays';
import { getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors';
import { StatisticType, IGalleryExtension, IExtensionGalleryService, IGalleryExtensionAsset, IQueryOptions, SortBy, SortOrder, IExtensionManifest, IExtensionIdentifier, IReportedExtension, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
import { StatisticType, IGalleryExtension, IExtensionGalleryService, IGalleryExtensionAsset, IQueryOptions, SortBy, SortOrder, IExtensionManifest, IExtensionIdentifier, IReportedExtension, InstallOperation, ITranslation } from 'vs/platform/extensionManagement/common/extensionManagement';
import { getGalleryExtensionId, getGalleryExtensionTelemetryData, adoptToGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { assign, getOrDefault } from 'vs/base/common/objects';
import { IRequestService } from 'vs/platform/request/node/request';
Expand Down Expand Up @@ -381,8 +381,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
.withFlags(Flags.IncludeLatestVersionOnly, Flags.IncludeAssetUri, Flags.IncludeStatistics, Flags.IncludeFiles, Flags.IncludeVersionProperties)
.withPage(1, pageSize)
.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code')
.withFilter(FilterType.ExcludeWithFlags, flagsToString(Flags.Unpublished))
.withAssetTypes(AssetType.Icon, AssetType.License, AssetType.Details, AssetType.Manifest, AssetType.VSIX, AssetType.Changelog);
.withFilter(FilterType.ExcludeWithFlags, flagsToString(Flags.Unpublished));

if (text) {
// Use category filter instead of "category:themes"
Expand Down Expand Up @@ -526,7 +525,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
.then(JSON.parse);
}

getCoreTranslations(extension: IGalleryExtension, languageId: string): TPromise<{}> {
getCoreTranslation(extension: IGalleryExtension, languageId: string): TPromise<ITranslation> {
const asset = extension.assets.coreTranslations[languageId.toUpperCase()];
if (asset) {
return this.getAsset(asset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
return;
}

this.galleryService.getCoreTranslations(extensionToFetchTranslationsFrom, locale)
.then(coreTranslation => {
this.galleryService.getCoreTranslation(extensionToFetchTranslationsFrom, locale)
.then(translation => {
const translations = {
...minimumTranslatedStrings,
...(coreTranslation ? coreTranslation['vs/platform/node/minimalTranslations'] : {})
...(translation && translation.contents ? translation.contents['vs/platform/node/minimalTranslations'] : {})
};
const logUserReaction = (userReaction: string) => {
/* __GDPR__
Expand Down

0 comments on commit 684b7e7

Please sign in to comment.