Reduce message panel min size to 0 (#2534)

* reduce message panel minimum size to 0; attempt to restore panel sizing on requery sizes; default grid panel size to 80%

* formatting
This commit is contained in:
Anthony Dresser
2018-09-11 21:22:06 -07:00
committed by Karl Burtram
parent 6c3c7c40b5
commit 82aa493dfd

View File

@@ -27,11 +27,12 @@ class ResultsView implements IPanelView {
private container = document.createElement('div'); private container = document.createElement('div');
private currentDimension: DOM.Dimension; private currentDimension: DOM.Dimension;
private isGridRendered = false; private isGridRendered = false;
private lastGridHeight: number;
constructor(instantiationService: IInstantiationService) { constructor(instantiationService: IInstantiationService) {
this.panelViewlet = instantiationService.createInstance(PanelViewlet, 'resultsView', { showHeaderInTitleWhenSingleView: false }); this.panelViewlet = instantiationService.createInstance(PanelViewlet, 'resultsView', { showHeaderInTitleWhenSingleView: false });
this.gridPanel = instantiationService.createInstance(GridPanel, { title: nls.localize('gridPanel', 'Results') }); this.gridPanel = instantiationService.createInstance(GridPanel, { title: nls.localize('gridPanel', 'Results'), id: 'gridPanel' });
this.messagePanel = instantiationService.createInstance(MessagePanel, { title: nls.localize('messagePanel', 'Messages') }); this.messagePanel = instantiationService.createInstance(MessagePanel, { title: nls.localize('messagePanel', 'Messages'), minimumBodySize: 0, id: 'messagePanel' });
this.gridPanel.render(); this.gridPanel.render();
this.messagePanel.render(); this.messagePanel.render();
this.panelViewlet.create(this.container).then(() => { this.panelViewlet.create(this.container).then(() => {
@@ -43,6 +44,7 @@ class ResultsView implements IPanelView {
let size = this.gridPanel.maximumBodySize; let size = this.gridPanel.maximumBodySize;
if (this.isGridRendered) { if (this.isGridRendered) {
if (size < 1) { if (size < 1) {
this.lastGridHeight = this.panelViewlet.getPanelSize(this.gridPanel);
this.panelViewlet.removePanels([this.gridPanel]); this.panelViewlet.removePanels([this.gridPanel]);
// tell the panel is has been removed. // tell the panel is has been removed.
this.gridPanel.layout(0); this.gridPanel.layout(0);
@@ -51,14 +53,14 @@ class ResultsView implements IPanelView {
} else { } else {
if (size > 0) { if (size > 0) {
this.panelViewlet.addPanels([ this.panelViewlet.addPanels([
{ panel: this.gridPanel, index: 0, size: this.gridPanel.maximumSize } { panel: this.gridPanel, index: 0, size: this.lastGridHeight || Math.round(this.currentDimension.height * .8) }
]); ]);
this.isGridRendered = true; this.isGridRendered = true;
} }
} }
}); });
let gridResizeList = this.gridPanel.onDidChange(e => { let gridResizeList = this.gridPanel.onDidChange(e => {
this.panelViewlet.resizePanel(this.gridPanel, this.gridPanel.maximumSize); this.panelViewlet.resizePanel(this.gridPanel, Math.round(this.currentDimension.height * .8));
}); });
// once the user changes the sash we should stop trying to resize the grid // once the user changes the sash we should stop trying to resize the grid
once(this.panelViewlet.onDidSashChange)(e => { once(this.panelViewlet.onDidSashChange)(e => {