提交 4617cb7f 编写于 作者: I isidor

debug: better view default sizes

上级 5ec387da
......@@ -13,24 +13,24 @@ export interface IDebugViewConstructorSignature {
}
export interface IDebugViewRegistry {
registerDebugView(view: IDebugViewConstructorSignature, order: number): void;
getDebugViews(): IDebugViewConstructorSignature[];
registerDebugView(view: IDebugViewConstructorSignature, order: number, weight: number): void;
getDebugViews(): { view: IDebugViewConstructorSignature, weight: number }[];
}
class DebugViewRegistryImpl implements IDebugViewRegistry {
private debugViews: { view: IDebugViewConstructorSignature, order: number }[];
private debugViews: { view: IDebugViewConstructorSignature, order: number, weight: number }[];
constructor() {
this.debugViews = [];
}
public registerDebugView(view: IDebugViewConstructorSignature, order: number): void {
this.debugViews.push({ view, order });
public registerDebugView(view: IDebugViewConstructorSignature, order: number, weight: number): void {
this.debugViews.push({ view, order, weight });
}
public getDebugViews(): IDebugViewConstructorSignature[] {
public getDebugViews(): { view: IDebugViewConstructorSignature, weight: number }[] {
return this.debugViews.sort((first, second) => first.order - second.order)
.map(viewWithOrder => viewWithOrder.view);
.map(viewWithOrder => ({ view: viewWithOrder.view, weight: viewWithOrder.weight }));
}
}
......
......@@ -60,15 +60,18 @@ export class DebugViewlet extends Viewlet {
this.$el = parent.div().addClass('debug-viewlet');
const actionRunner = this.getActionRunner();
this.views = DebugViewRegistry.getDebugViews().map(viewConstructor => this.instantiationService.createInstance(
viewConstructor,
const registeredViews = DebugViewRegistry.getDebugViews();
this.views = registeredViews.map(viewConstructor => this.instantiationService.createInstance(
viewConstructor.view,
actionRunner,
this.viewletSettings)
);
this.splitView = new SplitView(this.$el.getHTMLElement());
this.toDispose.push(this.splitView);
this.views.forEach(v => this.splitView.addView(v));
for (let i = 0; i < this.views.length; i++) {
this.splitView.addView(this.views[i], registeredViews[i].weight);
}
return TPromise.as(null);
}
......
......@@ -94,10 +94,10 @@ Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(new PanelDescri
Registry.as<PanelRegistry>(PanelExtensions.Panels).setDefaultPanelId(REPL_ID);
// Register default debug views
DebugViewRegistry.registerDebugView(VariablesView, 10);
DebugViewRegistry.registerDebugView(WatchExpressionsView, 20);
DebugViewRegistry.registerDebugView(CallStackView, 30);
DebugViewRegistry.registerDebugView(BreakpointsView, 40);
DebugViewRegistry.registerDebugView(VariablesView, 10, 40);
DebugViewRegistry.registerDebugView(WatchExpressionsView, 20, 10);
DebugViewRegistry.registerDebugView(CallStackView, 30, 30);
DebugViewRegistry.registerDebugView(BreakpointsView, 40, 20);
// register action to open viewlet
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryExtensions.WorkbenchActions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册