mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
@@ -10,7 +10,7 @@ import { localize } from 'vs/nls';
|
||||
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { CellToolbarLocation, CompactView, ConsolidatedRunButton, FocusIndicator, GlobalToolbar, InsertToolbarLocation, ShowCellStatusBarAfterExecuteKey, ShowCellStatusBarKey, UndoRedoPerCell } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { CellToolbarLocation, CompactView, ConsolidatedRunButton, FocusIndicator, GlobalToolbar, InsertToolbarLocation, ShowCellStatusBar, UndoRedoPerCell } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
|
||||
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
@@ -28,8 +28,7 @@ const profiles = {
|
||||
[GlobalToolbar]: false,
|
||||
[CellToolbarLocation]: { default: 'right' },
|
||||
[CompactView]: true,
|
||||
[ShowCellStatusBarKey]: true,
|
||||
[ShowCellStatusBarAfterExecuteKey]: false,
|
||||
[ShowCellStatusBar]: 'visible',
|
||||
[ConsolidatedRunButton]: true,
|
||||
[UndoRedoPerCell]: false
|
||||
},
|
||||
@@ -39,7 +38,7 @@ const profiles = {
|
||||
[GlobalToolbar]: true,
|
||||
[CellToolbarLocation]: { default: 'left' },
|
||||
[CompactView]: true,
|
||||
[ShowCellStatusBarKey]: true,
|
||||
[ShowCellStatusBar]: 'visible',
|
||||
[ConsolidatedRunButton]: false,
|
||||
[UndoRedoPerCell]: true
|
||||
},
|
||||
@@ -49,7 +48,7 @@ const profiles = {
|
||||
[GlobalToolbar]: false,
|
||||
[CellToolbarLocation]: { default: 'right' },
|
||||
[CompactView]: false,
|
||||
[ShowCellStatusBarKey]: false,
|
||||
[ShowCellStatusBar]: 'hidden',
|
||||
[ConsolidatedRunButton]: true,
|
||||
[UndoRedoPerCell]: false
|
||||
}
|
||||
@@ -108,16 +107,14 @@ export class NotebookProfileContribution extends Disposable {
|
||||
const globalToolbar = configService.getValue(GlobalToolbar);
|
||||
// const cellToolbarLocation = configService.getValue(CellToolbarLocation);
|
||||
const compactView = configService.getValue(CompactView);
|
||||
const showCellStatusBarKey = configService.getValue(ShowCellStatusBarKey);
|
||||
const showCellStatusBarAfterExecuteKey = configService.getValue(ShowCellStatusBarAfterExecuteKey);
|
||||
const showCellStatusBar = configService.getValue(ShowCellStatusBar);
|
||||
const consolidatedRunButton = configService.getValue(ConsolidatedRunButton);
|
||||
if (focusIndicator === 'border'
|
||||
&& insertToolbarPosition === 'both'
|
||||
&& globalToolbar === false
|
||||
// && cellToolbarLocation === undefined
|
||||
&& compactView === true
|
||||
&& showCellStatusBarKey === true
|
||||
&& showCellStatusBarAfterExecuteKey === false
|
||||
&& showCellStatusBar === 'visible'
|
||||
&& consolidatedRunButton === true
|
||||
) {
|
||||
applyProfile(configService, profiles[treatment] ?? profiles[NotebookProfileType.default]);
|
||||
|
||||
@@ -30,7 +30,7 @@ import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEd
|
||||
import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput';
|
||||
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
import { NotebookService } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl';
|
||||
import { CellKind, CellToolbarLocation, CellToolbarVisibility, CellUri, DisplayOrderKey, UndoRedoPerCell, ExperimentalUseMarkdownRenderer, getCellUndoRedoComparisonKey, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookTextDiffEditorPreview, NotebookWorkingCopyTypeIdentifier, ShowCellStatusBarKey, CompactView, FocusIndicator, InsertToolbarLocation, GlobalToolbar, ConsolidatedOutputButton, ShowFoldingControls, DragAndDropEnabled, ShowCellStatusBarAfterExecuteKey, NotebookCellEditorOptionsCustomizations, ConsolidatedRunButton } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { CellKind, CellToolbarLocation, CellToolbarVisibility, CellUri, DisplayOrderKey, UndoRedoPerCell, ExperimentalUseMarkdownRenderer, getCellUndoRedoComparisonKey, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookTextDiffEditorPreview, NotebookWorkingCopyTypeIdentifier, ShowCellStatusBar, CompactView, FocusIndicator, InsertToolbarLocation, GlobalToolbar, ConsolidatedOutputButton, ShowFoldingControls, DragAndDropEnabled, NotebookCellEditorOptionsCustomizations, ConsolidatedRunButton } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
|
||||
@@ -617,18 +617,17 @@ configurationRegistry.registerConfiguration({
|
||||
},
|
||||
tags: ['notebookLayout']
|
||||
},
|
||||
[ShowCellStatusBarKey]: {
|
||||
[ShowCellStatusBar]: {
|
||||
description: nls.localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown."),
|
||||
type: 'boolean',
|
||||
type: 'string',
|
||||
enum: ['hidden', 'visible', 'visibleAfterExecute'],
|
||||
enumDescriptions: [
|
||||
nls.localize('notebook.showCellStatusbar.hidden.description', "The cell status bar is always hidden."),
|
||||
nls.localize('notebook.showCellStatusbar.visible.description', "The cell status bar is always visible."),
|
||||
nls.localize('notebook.showCellStatusbar.visibleAfterExecute.description', "The cell status bar is hidden until the cell has executed. Then it becomes visible to show the execution status.")],
|
||||
default: true,
|
||||
tags: ['notebookLayout']
|
||||
},
|
||||
[ShowCellStatusBarAfterExecuteKey]: {
|
||||
description: nls.localize('notebook.showCellStatusbarAfterExecute.description', "Whether the cell status bar should be shown after the cell has been executed. Only has an effect if notebook.showCellStatusBar is false."),
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
tags: ['notebookLayout']
|
||||
},
|
||||
[NotebookTextDiffEditorPreview]: {
|
||||
description: nls.localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook."),
|
||||
type: 'boolean',
|
||||
|
||||
@@ -162,9 +162,9 @@ export abstract class BaseCellViewModel extends Disposable {
|
||||
}
|
||||
|
||||
private statusBarIsVisible(): boolean {
|
||||
if (this._viewContext.notebookOptions.getLayoutConfiguration().showCellStatusBar) {
|
||||
if (this._viewContext.notebookOptions.getLayoutConfiguration().showCellStatusBar === 'visible') {
|
||||
return true;
|
||||
} else if (this._viewContext.notebookOptions.getLayoutConfiguration().showCellStatusBarAfterExecute) {
|
||||
} else if (this._viewContext.notebookOptions.getLayoutConfiguration().showCellStatusBar === 'visibleAfterExecute') {
|
||||
return typeof this.internalMetadata.lastRunSuccess === 'boolean' || this.internalMetadata.runState !== undefined;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -911,8 +911,8 @@ export interface INotebookCellStatusBarItemList {
|
||||
export const DisplayOrderKey = 'notebook.displayOrder';
|
||||
export const CellToolbarLocation = 'notebook.cellToolbarLocation';
|
||||
export const CellToolbarVisibility = 'notebook.cellToolbarVisibility';
|
||||
export const ShowCellStatusBarKey = 'notebook.showCellStatusBar';
|
||||
export const ShowCellStatusBarAfterExecuteKey = 'notebook.showCellStatusBarAfterExecute';
|
||||
export type ShowCellStatusBarType = 'hidden' | 'visible' | 'visibleAfterExecute';
|
||||
export const ShowCellStatusBar = 'notebook.showCellStatusBar';
|
||||
export const NotebookTextDiffEditorPreview = 'notebook.diff.enablePreview';
|
||||
export const ExperimentalUseMarkdownRenderer = 'notebook.experimental.useMarkdownRenderer';
|
||||
export const ExperimentalInsertToolbarAlignment = 'notebook.experimental.insertToolbarAlignment';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationChangeEvent, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CellToolbarLocation, CellToolbarVisibility, CompactView, ConsolidatedOutputButton, ConsolidatedRunButton, DragAndDropEnabled, ExperimentalInsertToolbarAlignment, FocusIndicator, GlobalToolbar, InsertToolbarLocation, NotebookCellEditorOptionsCustomizations, ShowCellStatusBarAfterExecuteKey, ShowCellStatusBarKey, ShowFoldingControls } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { CellToolbarLocation, CellToolbarVisibility, CompactView, ConsolidatedOutputButton, ConsolidatedRunButton, DragAndDropEnabled, ExperimentalInsertToolbarAlignment, FocusIndicator, GlobalToolbar, InsertToolbarLocation, NotebookCellEditorOptionsCustomizations, ShowCellStatusBar, ShowCellStatusBarType, ShowFoldingControls } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
|
||||
const SCROLLABLE_ELEMENT_PADDING_TOP = 18;
|
||||
|
||||
@@ -43,8 +43,7 @@ export interface NotebookLayoutConfiguration {
|
||||
editorBottomPadding: number;
|
||||
editorBottomPaddingWithoutStatusBar: number;
|
||||
collapsedIndicatorHeight: number;
|
||||
showCellStatusBar: boolean;
|
||||
showCellStatusBarAfterExecute: boolean;
|
||||
showCellStatusBar: ShowCellStatusBarType;
|
||||
cellStatusBarHeight: number;
|
||||
cellToolbarLocation: string | { [key: string]: string };
|
||||
cellToolbarInteraction: string;
|
||||
@@ -108,8 +107,7 @@ export class NotebookOptions {
|
||||
private _disposables: IDisposable[];
|
||||
|
||||
constructor(private readonly configurationService: IConfigurationService) {
|
||||
const showCellStatusBar = this.configurationService.getValue<boolean>(ShowCellStatusBarKey);
|
||||
const showCellStatusBarAfterExecute = this.configurationService.getValue<boolean>(ShowCellStatusBarAfterExecuteKey);
|
||||
const showCellStatusBar = this.configurationService.getValue<ShowCellStatusBarType>(ShowCellStatusBar);
|
||||
const globalToolbar = this.configurationService.getValue<boolean | undefined>(GlobalToolbar) ?? false;
|
||||
const consolidatedOutputButton = this.configurationService.getValue<boolean | undefined>(ConsolidatedOutputButton) ?? true;
|
||||
const consolidatedRunButton = this.configurationService.getValue<boolean | undefined>(ConsolidatedRunButton) ?? false;
|
||||
@@ -142,7 +140,6 @@ export class NotebookOptions {
|
||||
editorBottomPaddingWithoutStatusBar: 12,
|
||||
collapsedIndicatorHeight: 24,
|
||||
showCellStatusBar,
|
||||
showCellStatusBarAfterExecute,
|
||||
globalToolbar,
|
||||
consolidatedOutputButton,
|
||||
consolidatedRunButton,
|
||||
@@ -171,8 +168,7 @@ export class NotebookOptions {
|
||||
}
|
||||
|
||||
private _updateConfiguration(e: IConfigurationChangeEvent) {
|
||||
const cellStatusBarVisibility = e.affectsConfiguration(ShowCellStatusBarKey);
|
||||
const cellStatusBarAfterExecuteVisibility = e.affectsConfiguration(ShowCellStatusBarAfterExecuteKey);
|
||||
const cellStatusBarVisibility = e.affectsConfiguration(ShowCellStatusBar);
|
||||
const cellToolbarLocation = e.affectsConfiguration(CellToolbarLocation);
|
||||
const cellToolbarInteraction = e.affectsConfiguration(CellToolbarVisibility);
|
||||
const compactView = e.affectsConfiguration(CompactView);
|
||||
@@ -189,7 +185,6 @@ export class NotebookOptions {
|
||||
|
||||
if (
|
||||
!cellStatusBarVisibility
|
||||
&& !cellStatusBarAfterExecuteVisibility
|
||||
&& !cellToolbarLocation
|
||||
&& !cellToolbarInteraction
|
||||
&& !compactView
|
||||
@@ -209,11 +204,7 @@ export class NotebookOptions {
|
||||
let configuration = Object.assign({}, this._layoutConfiguration);
|
||||
|
||||
if (cellStatusBarVisibility) {
|
||||
configuration.showCellStatusBar = this.configurationService.getValue<boolean>(ShowCellStatusBarKey);
|
||||
}
|
||||
|
||||
if (cellStatusBarAfterExecuteVisibility) {
|
||||
configuration.showCellStatusBarAfterExecute = this.configurationService.getValue<boolean>(ShowCellStatusBarAfterExecuteKey);
|
||||
configuration.showCellStatusBar = this.configurationService.getValue<ShowCellStatusBarType>(ShowCellStatusBar);
|
||||
}
|
||||
|
||||
if (cellToolbarLocation) {
|
||||
@@ -277,7 +268,6 @@ export class NotebookOptions {
|
||||
// trigger event
|
||||
this._onDidChangeOptions.fire({
|
||||
cellStatusBarVisibility,
|
||||
cellStatusBarAfterExecuteVisibility,
|
||||
cellToolbarLocation,
|
||||
cellToolbarInteraction,
|
||||
compactView,
|
||||
|
||||
@@ -12,15 +12,15 @@ const imageSize = 400;
|
||||
export default () => `
|
||||
<vertically-centered>
|
||||
<checklist>
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('default')}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarPosition == 'both' && config.notebook.globalToolbar == false && config.notebook.compactView == true && config.notebook.showCellStatusBar == true">
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('default')}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarPosition == 'both' && config.notebook.globalToolbar == false && config.notebook.compactView == true && config.notebook.showCellStatusBar == 'visible'">
|
||||
<img width="${imageSize}" src="./notebookThemes/default.png"/>
|
||||
${escape(localize('default', "Default"))}
|
||||
</checkbox>
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('jupyter')}" checked-on="config.notebook.cellFocusIndicator == 'gutter' && config.notebook.insertToolbarPosition == 'notebookToolbar' && config.notebook.globalToolbar == true && config.notebook.compactView == true && config.notebook.showCellStatusBar == true">
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('jupyter')}" checked-on="config.notebook.cellFocusIndicator == 'gutter' && config.notebook.insertToolbarPosition == 'notebookToolbar' && config.notebook.globalToolbar == true && config.notebook.compactView == true && config.notebook.showCellStatusBar == 'visible'">
|
||||
<img width="${imageSize}" src="./notebookThemes/jupyter.png"/>
|
||||
${escape(localize('jupyter', "Jupyter"))}
|
||||
</checkbox>
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('colab')}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarPosition == 'betweenCells' && config.notebook.globalToolbar == false && config.notebook.compactView == false && config.notebook.showCellStatusBar == false">
|
||||
<checkbox on-checked="command:notebook.setProfile?${profileArg('colab')}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarPosition == 'betweenCells' && config.notebook.globalToolbar == false && config.notebook.compactView == false && config.notebook.showCellStatusBar == 'hidden'">
|
||||
<img width="${imageSize}" src="./notebookThemes/colab.png"/>
|
||||
${escape(localize('colab', "Colab"))}
|
||||
</checkbox>
|
||||
|
||||
Reference in New Issue
Block a user