Show views in extension editor page
This commit is contained in:
parent
7c46b52166
commit
ca2491d916
2 changed files with 32 additions and 6 deletions
|
@ -74,10 +74,9 @@ export interface ITheme {
|
|||
label: string;
|
||||
}
|
||||
|
||||
export interface ITreeExplorer {
|
||||
export interface IView {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IExtensionContributions {
|
||||
|
@ -91,7 +90,7 @@ export interface IExtensionContributions {
|
|||
menus?: { [context: string]: IMenu[] };
|
||||
snippets?: ISnippet[];
|
||||
themes?: ITheme[];
|
||||
explorer?: ITreeExplorer;
|
||||
views?: { [location: string]: IView[] };
|
||||
}
|
||||
|
||||
export interface IExtensionManifest {
|
||||
|
|
|
@ -25,7 +25,7 @@ import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
|||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionGalleryService, IExtensionManifest, IKeyBinding } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionGalleryService, IExtensionManifest, IKeyBinding, IView } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
|
||||
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, IExtension, IExtensionDependencies } from 'vs/workbench/parts/extensions/common/extensions';
|
||||
|
@ -370,7 +370,8 @@ export class ExtensionEditor extends BaseEditor {
|
|||
this.renderLanguages(content, manifest, layout),
|
||||
this.renderThemes(content, manifest, layout),
|
||||
this.renderJSONValidation(content, manifest, layout),
|
||||
this.renderDebuggers(content, manifest, layout)
|
||||
this.renderDebuggers(content, manifest, layout),
|
||||
this.renderViews(content, manifest, layout)
|
||||
];
|
||||
|
||||
const isEmpty = !renders.reduce((v, r) => r || v, false);
|
||||
|
@ -495,6 +496,32 @@ export class ExtensionEditor extends BaseEditor {
|
|||
return true;
|
||||
}
|
||||
|
||||
private renderViews(container: HTMLElement, manifest: IExtensionManifest, onDetailsToggle: Function): boolean {
|
||||
const contributes = manifest.contributes;
|
||||
const contrib = contributes && contributes.views || {};
|
||||
|
||||
let views = <{ id: string, name: string, location: string }[]>Object.keys(contrib).reduce((result, location) => {
|
||||
let viewsForLocation: IView[] = contrib[location];
|
||||
result.push(...viewsForLocation.map(view => ({ ...view, location })));
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
if (!views.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const details = $('details', { open: true, ontoggle: onDetailsToggle },
|
||||
$('summary', null, localize('views', "Views ({0})", views.length)),
|
||||
$('table', null,
|
||||
$('tr', null, $('th', null, localize('view id', "ID")), $('th', null, localize('view name', "Name")), $('th', null, localize('view location', "Where"))),
|
||||
...views.map(view => $('tr', null, $('td', null, view.id), $('td', null, view.name), $('td', null, view.location)))
|
||||
)
|
||||
);
|
||||
|
||||
append(container, details);
|
||||
return true;
|
||||
}
|
||||
|
||||
private renderThemes(container: HTMLElement, manifest: IExtensionManifest, onDetailsToggle: Function): boolean {
|
||||
const contributes = manifest.contributes;
|
||||
const contrib = contributes && contributes.themes || [];
|
||||
|
|
Loading…
Reference in a new issue