Skip to content

Commit c41d631

Browse files
committed
move cell padding height to constants
1 parent 4996dcd commit c41d631

10 files changed

Lines changed: 20 additions & 15 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ export const COPY_CELL_UP_COMMAND_ID = 'workbench.notebook.cell.copyUp';
1818
export const COPY_CELL_DOWN_COMMAND_ID = 'workbench.notebook.cell.copyDown';
1919

2020
export const EXECUTE_CELL_COMMAND_ID = 'workbench.notebook.cell.execute';
21+
22+
// Cell sizing related
23+
export const CELL_MARGIN = 24;
24+
export const EDITOR_TOP_PADDING = 8;
25+
export const EDITOR_BOTTOM_PADDING = 8;
26+
export const EDITOR_TOOLBAR_HEIGHT = 22;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { INotebookService } from 'vs/workbench/contrib/notebook/browser/notebook
2727
import { OutputRenderer } from 'vs/workbench/contrib/notebook/browser/view/output/outputRenderer';
2828
import { BackLayerWebView } from 'vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView';
2929
import { CodeCellRenderer, MarkdownCellRenderer, NotebookCellListDelegate } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer';
30-
import { CELL_MARGIN, NotebookCellsSplice, IOutput, CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
30+
import { NotebookCellsSplice, IOutput, CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
3131
import { IWebviewService } from 'vs/workbench/contrib/webview/browser/webview';
3232
import { getExtraColor } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils';
3333
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
@@ -41,6 +41,7 @@ import { NotebookViewModel, INotebookEditorViewState, IModelDecorationsChangeAcc
4141
import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
4242
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel';
4343
import { Range } from 'vs/editor/common/core/range';
44+
import { CELL_MARGIN } from 'vs/workbench/contrib/notebook/browser/constants';
4445

4546
const $ = DOM.$;
4647
const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState';

src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import { IListService, IWorkbenchListOptions, WorkbenchList } from 'vs/platform/
1414
import { IThemeService } from 'vs/platform/theme/common/themeService';
1515
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
1616
import { isMacintosh } from 'vs/base/common/platform';
17-
import { EDITOR_TOP_PADDING, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon';
17+
import { NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1818
import { Range } from 'vs/editor/common/core/range';
1919
import { CellRevealType, CellRevealPosition, CursorAtBoundary } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
2020
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
2121
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel';
22+
import { EDITOR_TOP_PADDING } from 'vs/workbench/contrib/notebook/browser/constants';
2223

2324
export class NotebookCellList extends WorkbenchList<CellViewModel> implements IDisposable {
2425
get onWillScroll(): Event<ScrollEvent> { return this.view.onWillScroll; }

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import * as UUID from 'vs/base/common/uuid';
1111
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
1212
import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1313
import { INotebookService } from 'vs/workbench/contrib/notebook/browser/notebookService';
14-
import { CELL_MARGIN, IOutput } from 'vs/workbench/contrib/notebook/common/notebookCommon';
14+
import { IOutput } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1515
import { IWebviewService, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
1616
import { WebviewResourceScheme } from 'vs/workbench/contrib/webview/common/resourceLoader';
1717
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel';
18+
import { CELL_MARGIN } from 'vs/workbench/contrib/notebook/browser/constants';
1819

1920
export interface IDimentionMessage {
2021
type: 'dimension';

src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import { InsertCodeCellAboveAction, INotebookCellActionContext, InsertCodeCellBe
2222
import { CellRenderTemplate, INotebookEditor, ICellViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
2323
import { CodeCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/codeCell';
2424
import { StatefullMarkdownCell } from 'vs/workbench/contrib/notebook/browser/view/renderers/markdownCell';
25-
import { CellKind, EDITOR_BOTTOM_PADDING, EDITOR_TOP_PADDING, EDITOR_TOOLBAR_HEIGHT } from 'vs/workbench/contrib/notebook/common/notebookCommon';
25+
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
2626
import { CellViewModel } from '../../viewModel/notebookCellViewModel';
2727
import { ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
2828
import { MenuItemAction } from 'vs/platform/actions/common/actions';
2929
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
3030
import { INotificationService } from 'vs/platform/notification/common/notification';
31+
import { EDITOR_TOOLBAR_HEIGHT, EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING } from 'vs/workbench/contrib/notebook/browser/constants';
3132

3233
export class NotebookCellListDelegate implements IListVirtualDelegate<ICellViewModel> {
3334
private _lineHeight: number;

src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import * as nls from 'vs/nls';
77
import * as DOM from 'vs/base/browser/dom';
88
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
99
import { getResizesObserver } from 'vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver';
10-
import { CELL_MARGIN, IOutput, EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING, ITransformedDisplayOutputDto, IRenderOutput, CellOutputKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
10+
import { IOutput, ITransformedDisplayOutputDto, IRenderOutput, CellOutputKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1111
import { CellRenderTemplate, INotebookEditor, CellFocusMode } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1212
import { raceCancellation } from 'vs/base/common/async';
1313
import { CancellationTokenSource } from 'vs/base/common/cancellation';
1414
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
1515
import { INotebookService } from 'vs/workbench/contrib/notebook/browser/notebookService';
1616
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel';
17+
import { CELL_MARGIN, EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING } from 'vs/workbench/contrib/notebook/browser/constants';
1718

1819
interface IMimeTypeRenderer extends IQuickPickItem {
1920
index: number;

src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
88
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
99
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1010
import { getResizesObserver } from 'vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver';
11-
import { CELL_MARGIN, EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1211
import { INotebookEditor, CellRenderTemplate, CellFocusMode, CellState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1312
import { CancellationTokenSource } from 'vs/base/common/cancellation';
1413
import { raceCancellation } from 'vs/base/common/async';
1514
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel';
15+
import { CELL_MARGIN, EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING } from 'vs/workbench/contrib/notebook/browser/constants';
1616

1717
export class StatefullMarkdownCell extends Disposable {
1818
private editor: CodeEditorWidget | null = null;

src/vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
1515
import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer';
1616
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1717
import { MarkdownRenderer } from 'vs/workbench/contrib/notebook/browser/view/renderers/mdRenderer';
18-
import { CellKind, EDITOR_BOTTOM_PADDING, EDITOR_TOP_PADDING, ICell, IOutput, NotebookCellOutputsSplice, EDITOR_TOOLBAR_HEIGHT } from 'vs/workbench/contrib/notebook/common/notebookCommon';
18+
import { CellKind, ICell, IOutput, NotebookCellOutputsSplice } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1919
import { CellFindMatch, CellState, CursorAtBoundary, CellFocusMode, ICellViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
20+
import { EDITOR_TOP_PADDING, EDITOR_BOTTOM_PADDING, EDITOR_TOOLBAR_HEIGHT } from 'vs/workbench/contrib/notebook/browser/constants';
2021

2122
export class CellViewModel extends Disposable implements ICellViewModel {
2223

src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class NotebookViewModel extends Disposable {
130130
}
131131

132132
moveCellToIdx(index: number, newIdx: number): boolean {
133-
const viewCell = this.viewCells[index];
133+
const viewCell = this.viewCells[index] as CellViewModel;
134134
if (!viewCell) {
135135
return false;
136136
}

src/vs/workbench/contrib/notebook/common/notebookCommon.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ export interface IRenderOutput {
154154
hasDynamicHeight: boolean;
155155
}
156156

157-
export const CELL_MARGIN = 24;
158-
159-
export const EDITOR_TOP_PADDING = 8;
160-
export const EDITOR_BOTTOM_PADDING = 8;
161-
export const EDITOR_TOOLBAR_HEIGHT = 22;
162-
163-
164157
export type NotebookCellsSplice = [
165158
number /* start */,
166159
number /* delete count */,

0 commit comments

Comments
 (0)