From 9ec078369a2ecc1ac3869dfa14a75a412a79ee24 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 7 Apr 2020 15:41:04 +0200 Subject: [PATCH] debug: alllow to resize Breakpoints section in Debug sidebar fixes #46886 --- src/vs/workbench/contrib/debug/browser/breakpointsView.ts | 8 ++++---- .../contrib/debug/test/browser/breakpoints.test.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index afb4aa34477..9c986e88d19 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -51,9 +51,9 @@ function createCheckbox(): HTMLInputElement { } const MAX_VISIBLE_BREAKPOINTS = 9; -export function getExpandedBodySize(model: IDebugModel): number { +export function getExpandedBodySize(model: IDebugModel, countLimit: number): number { const length = model.getBreakpoints().length + model.getExceptionBreakpoints().length + model.getFunctionBreakpoints().length + model.getDataBreakpoints().length; - return Math.min(MAX_VISIBLE_BREAKPOINTS, length) * 22; + return Math.min(countLimit, length) * 22; } type BreakpointItem = IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IExceptionBreakpoint; @@ -233,8 +233,8 @@ export class BreakpointsView extends ViewPane { private updateSize(): void { // Adjust expanded body size - this.minimumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel()) : 170; - this.maximumBodySize = this.orientation === Orientation.VERTICAL ? this.minimumBodySize : Number.POSITIVE_INFINITY; + this.minimumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel(), MAX_VISIBLE_BREAKPOINTS) : 170; + this.maximumBodySize = this.orientation === Orientation.VERTICAL ? getExpandedBodySize(this.debugService.getModel(), Number.POSITIVE_INFINITY) : Number.POSITIVE_INFINITY; } private onBreakpointsChange(): void { diff --git a/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts b/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts index 732e78847c8..1d0321318ea 100644 --- a/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/breakpoints.test.ts @@ -98,10 +98,10 @@ suite('Debug - Breakpoints', () => { const modelUri1 = uri.file('/myfolder/my file first.js'); const modelUri2 = uri.file('/secondfolder/second/second file.js'); addBreakpointsAndCheckEvents(model, modelUri1, [{ lineNumber: 5, enabled: true }, { lineNumber: 10, enabled: false }]); - assert.equal(getExpandedBodySize(model), 44); + assert.equal(getExpandedBodySize(model, 9), 44); addBreakpointsAndCheckEvents(model, modelUri2, [{ lineNumber: 1, enabled: true }, { lineNumber: 2, enabled: true }, { lineNumber: 3, enabled: false }]); - assert.equal(getExpandedBodySize(model), 110); + assert.equal(getExpandedBodySize(model, 9), 110); assert.equal(model.getBreakpoints().length, 5); assert.equal(model.getBreakpoints({ uri: modelUri1 }).length, 2); @@ -135,7 +135,7 @@ suite('Debug - Breakpoints', () => { assert.equal(bp.enabled, true); model.removeBreakpoints(model.getBreakpoints({ uri: modelUri1 })); - assert.equal(getExpandedBodySize(model), 66); + assert.equal(getExpandedBodySize(model, 9), 66); assert.equal(model.getBreakpoints().length, 3); }); -- GitLab