提交 fa0236a3 编写于 作者: S Sandeep Somavarapu

Fix #54139

上级 f62aad4a
......@@ -54,7 +54,9 @@ export interface IExtension {
preview: boolean;
getManifest(): TPromise<IExtensionManifest>;
getReadme(): TPromise<string>;
hasReadme(): boolean;
getChangelog(): TPromise<string>;
hasChangelog(): boolean;
local?: ILocalExtension;
locals?: ILocalExtension[];
gallery?: IGalleryExtension;
......
......@@ -423,17 +423,27 @@ export class ExtensionEditor extends BaseEditor {
this.navbar.clear();
this.navbar.onChange(this.onNavbarChange.bind(this, extension), this, this.transientDisposables);
this.navbar.push(NavbarSection.Readme, localize('details', "Details"), localize('detailstooltip', "Extension details, rendered from the extension's 'README.md' file"));
if (extension.extensionPack.length) {
this.navbar.push(NavbarSection.ExtensionPack, localize('extensionPack', "Extension Pack"), localize('extensionsPack', "Set of extensions that can be installed together"));
}
this.navbar.push(NavbarSection.Contributions, localize('contributions', "Contributions"), localize('contributionstooltip', "Lists contributions to VS Code by this extension"));
this.navbar.push(NavbarSection.Changelog, localize('changelog', "Changelog"), localize('changelogtooltip', "Extension update history, rendered from the extension's 'CHANGELOG.md' file"));
if (extension.dependencies.length) {
this.navbar.push(NavbarSection.Dependencies, localize('dependencies', "Dependencies"), localize('dependenciestooltip', "Lists extensions this extension depends on"));
if (extension.hasReadme()) {
this.navbar.push(NavbarSection.Readme, localize('details', "Details"), localize('detailstooltip', "Extension details, rendered from the extension's 'README.md' file"));
}
this.extensionManifest.get()
.then(manifest => {
if (extension.extensionPack.length) {
this.navbar.push(NavbarSection.ExtensionPack, localize('extensionPack', "Extension Pack"), localize('extensionsPack', "Set of extensions that can be installed together"));
}
if (manifest.contributes) {
this.navbar.push(NavbarSection.Contributions, localize('contributions', "Contributions"), localize('contributionstooltip', "Lists contributions to VS Code by this extension"));
}
if (extension.hasChangelog()) {
this.navbar.push(NavbarSection.Changelog, localize('changelog', "Changelog"), localize('changelogtooltip', "Extension update history, rendered from the extension's 'CHANGELOG.md' file"));
}
if (extension.dependencies.length) {
this.navbar.push(NavbarSection.Dependencies, localize('dependencies', "Dependencies"), localize('dependenciestooltip', "Lists extensions this extension depends on"));
}
this.editorLoadComplete = true;
});
this.editorLoadComplete = true;
return super.setInput(input, options, token);
}
......
......@@ -218,6 +218,18 @@ class Extension implements IExtension {
return TPromise.as(this.local.manifest);
}
hasReadme(): boolean {
if (this.gallery && !this.isGalleryOutdated() && this.gallery.assets.readme) {
return true;
}
if (this.local && this.local.readmeUrl) {
return true;
}
return this.type === LocalExtensionType.System;
}
getReadme(): TPromise<string> {
if (this.gallery && !this.isGalleryOutdated()) {
if (this.gallery.assets.readme) {
......@@ -242,6 +254,19 @@ ${this.description}
return TPromise.wrapError<string>(new Error('not available'));
}
hasChangelog(): boolean {
if (this.gallery && this.gallery.assets.changelog && !this.isGalleryOutdated()) {
return true;
}
if (this.local && this.local.changelogUrl) {
const uri = URI.parse(this.local.changelogUrl);
return uri.scheme === 'file';
}
return false;
}
getChangelog(): TPromise<string> {
if (this.gallery && this.gallery.assets.changelog && !this.isGalleryOutdated()) {
return this.galleryService.getChangelog(this.gallery);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册