mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 22:37:41 +00:00
add getChangelog method to IExtension and its impl
This commit is contained in:
parent
3027fff306
commit
50b7571b0a
|
@ -42,6 +42,7 @@ export interface IExtension {
|
|||
telemetryData: any;
|
||||
getManifest(): TPromise<IExtensionManifest>;
|
||||
getReadme(): TPromise<string>;
|
||||
getChangelog() : TPromise<string>;
|
||||
}
|
||||
|
||||
export const SERVICE_ID = 'extensionsWorkbenchService';
|
||||
|
|
|
@ -94,6 +94,14 @@ class Extension implements IExtension {
|
|||
return this.gallery && this.gallery.assets.readme;
|
||||
}
|
||||
|
||||
get changelogUrl(): string {
|
||||
if (this.local && this.local.changelogUrl) {
|
||||
return this.local.changelogUrl;
|
||||
}
|
||||
|
||||
return ''; // Hopefully we will change this once the gallery will support that.
|
||||
}
|
||||
|
||||
get iconUrl(): string {
|
||||
return this.localIconUrl || this.galleryIconUrl || this.defaultIconUrl;
|
||||
}
|
||||
|
@ -178,6 +186,22 @@ class Extension implements IExtension {
|
|||
|
||||
return this.galleryService.getAsset(readmeUrl).then(asText);
|
||||
}
|
||||
|
||||
getChangelog() : TPromise<string> {
|
||||
const changelogUrl = this.local && this.local.changelogUrl ? this.local.changelogUrl : '';
|
||||
|
||||
if (!changelogUrl) {
|
||||
return TPromise.wrapError('not available');
|
||||
}
|
||||
|
||||
const uri = URI.parse(changelogUrl);
|
||||
|
||||
if (uri.scheme === 'file') {
|
||||
return readFile(uri.fsPath, 'utf8');
|
||||
}
|
||||
|
||||
return TPromise.wrapError('not available');
|
||||
}
|
||||
}
|
||||
|
||||
function stripVersion(id: string): string {
|
||||
|
|
Loading…
Reference in a new issue