Skip to content

Commit c6017c3

Browse files
committed
Add view options update for list view.
1 parent b08275d commit c6017c3

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/vs/base/browser/ui/list/listView.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
275275
this.layout();
276276
}
277277

278+
updateOptions(options: IListViewOptions<T>) {
279+
if (options.additionalScrollHeight !== undefined) {
280+
this.additionalScrollHeight = options.additionalScrollHeight;
281+
}
282+
}
283+
278284
triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
279285
this.scrollableElement.triggerScrollFromMouseWheelEvent(browserEvent);
280286
}

src/vs/base/browser/ui/list/listWidget.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ export interface IListOptions<T> {
854854
readonly mouseSupport?: boolean;
855855
readonly horizontalScrolling?: boolean;
856856
readonly ariaProvider?: IAriaProvider<T>;
857+
readonly additionalScrollHeight?: number;
857858
}
858859

859860
export interface IListStyles {
@@ -1110,6 +1111,7 @@ class ListViewDragAndDrop<T> implements IListViewDragAndDrop<T> {
11101111
export interface IListOptionsUpdate {
11111112
readonly enableKeyboardNavigation?: boolean;
11121113
readonly automaticKeyboardNavigation?: boolean;
1114+
readonly additionalScrollHeight?: number;
11131115
}
11141116

11151117
export class List<T> implements ISpliceable<T>, IDisposable {
@@ -1289,6 +1291,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {
12891291
if (this.typeLabelController) {
12901292
this.typeLabelController.updateOptions(this._options);
12911293
}
1294+
1295+
if (optionsUpdate.additionalScrollHeight !== undefined) {
1296+
this.view.updateOptions(optionsUpdate);
1297+
}
12921298
}
12931299

12941300
get options(): IListOptions<T> {

src/vs/workbench/contrib/notebook/browser/notebookEditor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
201201
mouseSupport: true,
202202
multipleSelectionSupport: false,
203203
enableKeyboardNavigation: true,
204+
additionalScrollHeight: 0,
204205
overrideStyles: {
205206
listBackground: editorBackground,
206207
listActiveSelectionBackground: editorBackground,
@@ -419,6 +420,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
419420
DOM.toggleClass(this.rootElement, 'mid-width', dimension.width < 1000 && dimension.width >= 600);
420421
DOM.toggleClass(this.rootElement, 'narrow-width', dimension.width < 600);
421422
DOM.size(this.body, dimension.width, dimension.height);
423+
this.list?.updateOptions({ additionalScrollHeight: dimension.height });
422424
this.list?.layout(dimension.height, dimension.width);
423425
this.eventDispatcher?.emit([new NotebookLayoutChangedEvent({ width: true, fontInfo: true }, this.getLayoutInfo())]);
424426
}

0 commit comments

Comments
 (0)