added setting for notebook output line height
parent
675b8c3da0
commit
9a87fe7eaf
|
@ -174,7 +174,7 @@ export const activate: ActivationFunction<void> = (ctx) => {
|
||||||
.output-plaintext,
|
.output-plaintext,
|
||||||
.output-stream,
|
.output-stream,
|
||||||
.traceback {
|
.traceback {
|
||||||
line-height: 22px;
|
line-height: var(--notebook-cell-output-line-height);
|
||||||
font-family: var(--notebook-cell-output-font-family);
|
font-family: var(--notebook-cell-output-font-family);
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
@ -185,6 +185,9 @@ export const activate: ActivationFunction<void> = (ctx) => {
|
||||||
-ms-user-select: text;
|
-ms-user-select: text;
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
|
span.output-stream {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
.output-plaintext .code-bold,
|
.output-plaintext .code-bold,
|
||||||
.output-stream .code-bold,
|
.output-stream .code-bold,
|
||||||
.traceback .code-bold {
|
.traceback .code-bold {
|
||||||
|
|
|
@ -892,5 +892,11 @@ configurationRegistry.registerConfiguration({
|
||||||
enum: ['always', 'never', 'fromEditor'],
|
enum: ['always', 'never', 'fromEditor'],
|
||||||
default: 'fromEditor'
|
default: 'fromEditor'
|
||||||
},
|
},
|
||||||
|
[NotebookSetting.outputLineHeight]: {
|
||||||
|
markdownDescription: nls.localize('notebook.outputLineHeight', "line height of the output text"),
|
||||||
|
type: 'number',
|
||||||
|
default: 22,
|
||||||
|
tags: ['notebookLayout']
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -397,7 +397,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
|
||||||
this._updateForNotebookConfiguration();
|
this._updateForNotebookConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.compactView || e.focusIndicator || e.insertToolbarPosition || e.cellToolbarLocation || e.dragAndDropEnabled || e.fontSize || e.markupFontSize || e.insertToolbarAlignment) {
|
if (e.compactView || e.focusIndicator || e.insertToolbarPosition || e.cellToolbarLocation || e.dragAndDropEnabled || e.fontSize || e.markupFontSize || e.insertToolbarAlignment || e.outputLineHeight) {
|
||||||
this._styleElement?.remove();
|
this._styleElement?.remove();
|
||||||
this._createLayoutStyles();
|
this._createLayoutStyles();
|
||||||
this._webview?.updateOptions({
|
this._webview?.updateOptions({
|
||||||
|
|
|
@ -81,6 +81,7 @@ export interface INotebookDelegateForWebview {
|
||||||
interface BacklayerWebviewOptions {
|
interface BacklayerWebviewOptions {
|
||||||
readonly outputNodePadding: number;
|
readonly outputNodePadding: number;
|
||||||
readonly outputNodeLeftPadding: number;
|
readonly outputNodeLeftPadding: number;
|
||||||
|
readonly outputLineHeight: number;
|
||||||
readonly previewNodePadding: number;
|
readonly previewNodePadding: number;
|
||||||
readonly markdownLeftMargin: number;
|
readonly markdownLeftMargin: number;
|
||||||
readonly leftMargin: number;
|
readonly leftMargin: number;
|
||||||
|
@ -205,6 +206,7 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
|
||||||
'notebook-markdown-min-height': `${this.options.previewNodePadding * 2}px`,
|
'notebook-markdown-min-height': `${this.options.previewNodePadding * 2}px`,
|
||||||
'notebook-markup-font-size': typeof this.options.markupFontSize === 'number' && this.options.markupFontSize > 0 ? `${this.options.markupFontSize}px` : `calc(${this.options.fontSize}px * 1.2)`,
|
'notebook-markup-font-size': typeof this.options.markupFontSize === 'number' && this.options.markupFontSize > 0 ? `${this.options.markupFontSize}px` : `calc(${this.options.fontSize}px * 1.2)`,
|
||||||
'notebook-cell-output-font-size': `${this.options.fontSize}px`,
|
'notebook-cell-output-font-size': `${this.options.fontSize}px`,
|
||||||
|
'notebook-cell-output-line-height': `${this.options.outputLineHeight}px`,
|
||||||
'notebook-cell-output-font-family': this.options.fontFamily,
|
'notebook-cell-output-font-family': this.options.fontFamily,
|
||||||
'notebook-cell-markup-empty-content': nls.localize('notebook.emptyMarkdownPlaceholder', "Empty markdown cell, double click or press enter to edit."),
|
'notebook-cell-markup-empty-content': nls.localize('notebook.emptyMarkdownPlaceholder', "Empty markdown cell, double click or press enter to edit."),
|
||||||
'notebook-cell-renderer-not-found-error': nls.localize({
|
'notebook-cell-renderer-not-found-error': nls.localize({
|
||||||
|
|
|
@ -913,7 +913,8 @@ export const NotebookSetting = {
|
||||||
textOutputLineLimit: 'notebook.output.textLineLimit',
|
textOutputLineLimit: 'notebook.output.textLineLimit',
|
||||||
globalToolbarShowLabel: 'notebook.globalToolbarShowLabel',
|
globalToolbarShowLabel: 'notebook.globalToolbarShowLabel',
|
||||||
markupFontSize: 'notebook.markup.fontSize',
|
markupFontSize: 'notebook.markup.fontSize',
|
||||||
interactiveWindowCollapseCodeCells: 'interactiveWindow.collapseCellInputCode'
|
interactiveWindowCollapseCodeCells: 'interactiveWindow.collapseCellInputCode',
|
||||||
|
outputLineHeight: 'notebook.outputLineHeight'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const enum CellStatusbarAlignment {
|
export const enum CellStatusbarAlignment {
|
||||||
|
|
|
@ -62,6 +62,7 @@ export interface NotebookLayoutConfiguration {
|
||||||
showFoldingControls: 'always' | 'mouseover';
|
showFoldingControls: 'always' | 'mouseover';
|
||||||
dragAndDropEnabled: boolean;
|
dragAndDropEnabled: boolean;
|
||||||
fontSize: number;
|
fontSize: number;
|
||||||
|
outputLineHeight: number;
|
||||||
markupFontSize: number;
|
markupFontSize: number;
|
||||||
focusIndicatorLeftMargin: number;
|
focusIndicatorLeftMargin: number;
|
||||||
editorOptionsCustomizations: any | undefined;
|
editorOptionsCustomizations: any | undefined;
|
||||||
|
@ -87,6 +88,7 @@ export interface NotebookOptionsChangeEvent {
|
||||||
readonly markupFontSize?: boolean;
|
readonly markupFontSize?: boolean;
|
||||||
readonly editorOptionsCustomizations?: boolean;
|
readonly editorOptionsCustomizations?: boolean;
|
||||||
readonly interactiveWindowCollapseCodeCells?: boolean;
|
readonly interactiveWindowCollapseCodeCells?: boolean;
|
||||||
|
readonly outputLineHeight?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultConfigConstants = Object.freeze({
|
const defaultConfigConstants = Object.freeze({
|
||||||
|
@ -137,6 +139,7 @@ export class NotebookOptions extends Disposable {
|
||||||
const markupFontSize = this.configurationService.getValue<number>(NotebookSetting.markupFontSize);
|
const markupFontSize = this.configurationService.getValue<number>(NotebookSetting.markupFontSize);
|
||||||
const editorOptionsCustomizations = this.configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations);
|
const editorOptionsCustomizations = this.configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations);
|
||||||
const interactiveWindowCollapseCodeCells: InteractiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
|
const interactiveWindowCollapseCodeCells: InteractiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
|
||||||
|
const outputLineHeight = this.configurationService.getValue<number>(NotebookSetting.outputLineHeight);
|
||||||
|
|
||||||
this._layoutConfiguration = {
|
this._layoutConfiguration = {
|
||||||
...(compactView ? compactConfigConstants : defaultConfigConstants),
|
...(compactView ? compactConfigConstants : defaultConfigConstants),
|
||||||
|
@ -166,6 +169,7 @@ export class NotebookOptions extends Disposable {
|
||||||
insertToolbarAlignment,
|
insertToolbarAlignment,
|
||||||
showFoldingControls,
|
showFoldingControls,
|
||||||
fontSize,
|
fontSize,
|
||||||
|
outputLineHeight,
|
||||||
markupFontSize,
|
markupFontSize,
|
||||||
editorOptionsCustomizations,
|
editorOptionsCustomizations,
|
||||||
focusIndicatorGap: 3,
|
focusIndicatorGap: 3,
|
||||||
|
@ -202,6 +206,7 @@ export class NotebookOptions extends Disposable {
|
||||||
const markupFontSize = e.affectsConfiguration(NotebookSetting.markupFontSize);
|
const markupFontSize = e.affectsConfiguration(NotebookSetting.markupFontSize);
|
||||||
const editorOptionsCustomizations = e.affectsConfiguration(NotebookSetting.cellEditorOptionsCustomizations);
|
const editorOptionsCustomizations = e.affectsConfiguration(NotebookSetting.cellEditorOptionsCustomizations);
|
||||||
const interactiveWindowCollapseCodeCells = e.affectsConfiguration(NotebookSetting.interactiveWindowCollapseCodeCells);
|
const interactiveWindowCollapseCodeCells = e.affectsConfiguration(NotebookSetting.interactiveWindowCollapseCodeCells);
|
||||||
|
const outputLineHeight = e.affectsConfiguration(NotebookSetting.outputLineHeight);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!cellStatusBarVisibility
|
!cellStatusBarVisibility
|
||||||
|
@ -219,7 +224,8 @@ export class NotebookOptions extends Disposable {
|
||||||
&& !fontSize
|
&& !fontSize
|
||||||
&& !markupFontSize
|
&& !markupFontSize
|
||||||
&& !editorOptionsCustomizations
|
&& !editorOptionsCustomizations
|
||||||
&& !interactiveWindowCollapseCodeCells) {
|
&& !interactiveWindowCollapseCodeCells
|
||||||
|
&& !outputLineHeight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,8 +299,13 @@ export class NotebookOptions extends Disposable {
|
||||||
configuration.interactiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
|
configuration.interactiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (outputLineHeight) {
|
||||||
|
configuration.outputLineHeight = this.configurationService.getValue<number>(NotebookSetting.outputLineHeight);
|
||||||
|
}
|
||||||
|
|
||||||
this._layoutConfiguration = Object.freeze(configuration);
|
this._layoutConfiguration = Object.freeze(configuration);
|
||||||
|
|
||||||
|
// add new configuration to the event?
|
||||||
// trigger event
|
// trigger event
|
||||||
this._onDidChangeOptions.fire({
|
this._onDidChangeOptions.fire({
|
||||||
cellStatusBarVisibility,
|
cellStatusBarVisibility,
|
||||||
|
@ -312,7 +323,8 @@ export class NotebookOptions extends Disposable {
|
||||||
fontSize,
|
fontSize,
|
||||||
markupFontSize,
|
markupFontSize,
|
||||||
editorOptionsCustomizations,
|
editorOptionsCustomizations,
|
||||||
interactiveWindowCollapseCodeCells
|
interactiveWindowCollapseCodeCells,
|
||||||
|
outputLineHeight
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,6 +515,7 @@ export class NotebookOptions extends Disposable {
|
||||||
dragAndDropEnabled: this._layoutConfiguration.dragAndDropEnabled,
|
dragAndDropEnabled: this._layoutConfiguration.dragAndDropEnabled,
|
||||||
fontSize: this._layoutConfiguration.fontSize,
|
fontSize: this._layoutConfiguration.fontSize,
|
||||||
markupFontSize: this._layoutConfiguration.markupFontSize,
|
markupFontSize: this._layoutConfiguration.markupFontSize,
|
||||||
|
outputLineHeight: this._layoutConfiguration.outputLineHeight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,6 +531,7 @@ export class NotebookOptions extends Disposable {
|
||||||
dragAndDropEnabled: false,
|
dragAndDropEnabled: false,
|
||||||
fontSize: this._layoutConfiguration.fontSize,
|
fontSize: this._layoutConfiguration.fontSize,
|
||||||
markupFontSize: this._layoutConfiguration.markupFontSize,
|
markupFontSize: this._layoutConfiguration.markupFontSize,
|
||||||
|
outputLineHeight: this._layoutConfiguration.outputLineHeight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue