Skip to content

Commit f244628

Browse files
authored
experiment setting for nb overview (microsoft#162223)
exp setting for nb overview
1 parent 8efe4be commit f244628

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffEditor.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
157157
this._revealFirst = true;
158158
}
159159

160+
private isOverviewRulerEnabled(): boolean {
161+
return this.configurationService.getValue('notebook.experimental.diffOverviewRuler.enabled') ?? false;
162+
}
163+
160164
getSelection(): IEditorPaneSelection | undefined {
161165
const selections = this._list.getFocus();
162166
return new NotebookDiffEditorSelection(selections);
@@ -559,7 +563,9 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
559563
private _setViewModel(viewModels: DiffElementViewModelBase[]) {
560564
this._diffElementViewModels = viewModels;
561565
this._list.splice(0, this._list.length, this._diffElementViewModels);
562-
this._overviewRuler.updateViewModels(this._diffElementViewModels, this._eventDispatcher);
566+
if (this.isOverviewRulerEnabled()) {
567+
this._overviewRuler.updateViewModels(this._diffElementViewModels, this._eventDispatcher);
568+
}
563569
}
564570

565571
/**
@@ -976,7 +982,8 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
976982
layout(dimension: DOM.Dimension): void {
977983
this._rootElement.classList.toggle('mid-width', dimension.width < 1000 && dimension.width >= 600);
978984
this._rootElement.classList.toggle('narrow-width', dimension.width < 600);
979-
this._dimension = dimension.with(dimension.width - NotebookTextDiffEditor.ENTIRE_DIFF_OVERVIEW_WIDTH);
985+
const overviewRulerEnabled = this.isOverviewRulerEnabled();
986+
this._dimension = dimension.with(dimension.width - (overviewRulerEnabled ? NotebookTextDiffEditor.ENTIRE_DIFF_OVERVIEW_WIDTH : 0));
980987

981988
this._listViewContainer.style.height = `${dimension.height}px`;
982989
this._listViewContainer.style.width = `${this._dimension.width}px`;
@@ -998,7 +1005,9 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
9981005
this._webviewTransparentCover.style.width = `${this._dimension.width}px`;
9991006
}
10001007

1001-
this._overviewRuler.layout();
1008+
if (overviewRulerEnabled) {
1009+
this._overviewRuler.layout();
1010+
}
10021011

10031012
this._eventDispatcher?.emit([new NotebookDiffLayoutChangedEvent({ width: true, fontInfo: true }, this.getLayoutInfo())]);
10041013
}

0 commit comments

Comments
 (0)