Skip to content

Commit

Permalink
ask for extension icon in query
Browse files Browse the repository at this point in the history
related to #10180
  • Loading branch information
joaomoreno committed Aug 9, 2016
1 parent 974bce4 commit 86d1382
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions src/vs/platform/extensionManagement/node/extensionGalleryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import product from 'vs/platform/product';

interface IRawGalleryExtensionFile {
assetType: string;
source: string;
}

interface IRawGalleryExtensionVersion {
Expand Down Expand Up @@ -152,15 +153,20 @@ function getStatistic(statistics: IRawGalleryExtensionStatistics[], name: string
}

function toExtension(galleryExtension: IRawGalleryExtension, extensionsGalleryUrl: string, downloadHeaders: any): IGalleryExtension {
const versions = galleryExtension.versions.map<IGalleryVersion>(v => ({
version: v.version,
date: v.lastUpdated,
downloadHeaders,
downloadUrl: `${ v.assetUri }/${ AssetType.VSIX }?install=true`,
manifestUrl: `${ v.assetUri }/${ AssetType.Manifest }`,
readmeUrl: `${ v.assetUri }/${ AssetType.Details }`,
iconUrl: `${ v.assetUri }/${ AssetType.Icon }`
}));
const versions = galleryExtension.versions.map<IGalleryVersion>(v => {
const iconFile = v.files.filter(f => f.assetType === AssetType.Icon)[0];
const iconUrl = iconFile ? iconFile.source : require.toUrl('./media/defaultIcon.png');

return {
version: v.version,
date: v.lastUpdated,
downloadHeaders,
downloadUrl: `${ v.assetUri }/${ AssetType.VSIX }?install=true`,
manifestUrl: `${ v.assetUri }/${ AssetType.Manifest }`,
readmeUrl: `${ v.assetUri }/${ AssetType.Details }`,
iconUrl
};
});

return {
id: galleryExtension.extensionId,
Expand Down Expand Up @@ -213,9 +219,10 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
this.telemetryService.publicLog('galleryService:query', { type, text });

let query = new Query()
.withFlags(Flags.IncludeVersions, Flags.IncludeCategoryAndTags, Flags.IncludeAssetUri, Flags.IncludeStatistics)
.withFlags(Flags.IncludeVersions, Flags.IncludeCategoryAndTags, Flags.IncludeAssetUri, Flags.IncludeStatistics, Flags.IncludeFiles)
.withPage(1, pageSize)
.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code');
.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code')
.withAssetTypes(AssetType.Icon);

if (text) {
query = query.withFilter(FilterType.SearchText, text).withSortBy(SortBy.NoneOrRelevance);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Extension implements IExtension {
return URI.file(path.join(this.local.path, this.local.manifest.icon)).toString();
}

if (this.gallery && this.gallery.versions[0].iconUrl) {
if (this.gallery) {
return this.gallery.versions[0].iconUrl;
}

Expand Down

0 comments on commit 86d1382

Please sign in to comment.