Skip to content

Commit 6d0d2c5

Browse files
justschenmustard-mh
authored andcommitted
use layout service so we are properly computing the container (microsoft#245185)
change to use layout service so we are properly computing the container
1 parent 6ad315d commit 6d0d2c5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/vs/platform/actionWidget/browser/actionList.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { IContextViewService } from '../../contextview/browser/contextView.js';
1818
import { IKeybindingService } from '../../keybinding/common/keybinding.js';
1919
import { defaultListStyles } from '../../theme/browser/defaultStyles.js';
2020
import { asCssVariable } from '../../theme/common/colorRegistry.js';
21+
import { ILayoutService } from '../../layout/browser/layoutService.js';
2122

2223
export const acceptSelectedActionCommand = 'acceptSelectedCodeAction';
2324
export const previewSelectedActionCommand = 'previewSelectedCodeAction';
@@ -182,10 +183,10 @@ export class ActionList<T> extends Disposable {
182183
items: readonly IActionListItem<T>[],
183184
private readonly _delegate: IActionListDelegate<T>,
184185
@IContextViewService private readonly _contextViewService: IContextViewService,
185-
@IKeybindingService private readonly _keybindingService: IKeybindingService
186+
@IKeybindingService private readonly _keybindingService: IKeybindingService,
187+
@ILayoutService private readonly _layoutService: ILayoutService,
186188
) {
187189
super();
188-
189190
this.domNode = document.createElement('div');
190191
this.domNode.classList.add('actionList');
191192
const virtualDelegate: IListVirtualDelegate<IActionListItem<T>> = {
@@ -270,7 +271,7 @@ export class ActionList<T> extends Disposable {
270271
}
271272

272273
const maxVhPrecentage = 0.7;
273-
const height = Math.min(heightWithHeaders, this.domNode.ownerDocument.body.clientHeight * maxVhPrecentage);
274+
const height = Math.min(heightWithHeaders, this._layoutService.mainContainerDimension.height * maxVhPrecentage);
274275
this._list.layout(height, maxWidth);
275276

276277
this.domNode.style.height = `${height}px`;

0 commit comments

Comments
 (0)