From 87ea829ceffa8bfbe3ce69f5314b5e33a364615e Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 9 Nov 2021 13:55:56 -0800 Subject: [PATCH] Move notebook setting keys into a namespace Adds a new `NotebookSettings` namespace to hold notebook settings keys --- .../gettingStarted/notebookGettingStarted.ts | 6 +- .../browser/contrib/layout/layoutActions.ts | 6 +- .../contrib/profile/notebookProfile.ts | 64 +++++++-------- .../browser/controller/executeActions.ts | 10 +-- .../browser/controller/insertCellActions.ts | 4 +- .../browser/controller/layoutActions.ts | 8 +- .../notebook/browser/notebook.contribution.ts | 40 +++++----- .../notebook/browser/notebookServiceImpl.ts | 10 +-- .../view/output/transforms/richTransform.ts | 6 +- .../viewParts/notebookEditorToolbar.ts | 8 +- .../contrib/notebook/common/notebookCommon.ts | 43 +++++----- .../notebook/common/notebookOptions.ts | 78 +++++++++---------- .../common/gettingStartedContent.ts | 4 +- 13 files changed, 145 insertions(+), 142 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.ts b/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.ts index e13987153f8..18965b389d0 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.ts @@ -16,7 +16,7 @@ import { CATEGORIES } from 'vs/workbench/common/actions'; import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { Memento } from 'vs/workbench/common/memento'; import { HAS_OPENED_NOTEBOOK } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; -import { OpenGettingStarted } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; @@ -45,7 +45,7 @@ export class NotebookGettingStarted extends Disposable implements IWorkbenchCont hasOpenedNotebook.set(true); } - const needToShowGettingStarted = _configurationService.getValue(OpenGettingStarted) && !storedValue[hasShownGettingStartedKey]; + const needToShowGettingStarted = _configurationService.getValue(NotebookSetting.openGettingStarted) && !storedValue[hasShownGettingStartedKey]; if (!storedValue[hasOpenedNotebookKey] || needToShowGettingStarted) { const onDidOpenNotebook = () => { hasOpenedNotebook.set(true); @@ -83,7 +83,7 @@ registerAction2(class NotebookClearNotebookLayoutAction extends Action2 { id: 'workbench.notebook.layout.gettingStarted', title: localize('workbench.notebook.layout.gettingStarted.label', "Reset notebook getting started"), f1: true, - precondition: ContextKeyExpr.equals(`config.${OpenGettingStarted}`, true), + precondition: ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true), category: CATEGORIES.Developer, }); } diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.ts b/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.ts index c764085038f..fe1c2706c22 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.ts @@ -8,7 +8,7 @@ import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/act import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { INotebookActionContext, NOTEBOOK_ACTIONS_CATEGORY } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; -import { CellToolbarLocation } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; const TOGGLE_CELL_TOOLBAR_POSITION = 'notebook.toggleCellToolbarPosition'; @@ -33,9 +33,9 @@ export class ToggleCellToolbarPositionAction extends Action2 { // from toolbar const viewType = editor.textModel.viewType; const configurationService = accessor.get(IConfigurationService); - const toolbarPosition = configurationService.getValue(CellToolbarLocation); + const toolbarPosition = configurationService.getValue(NotebookSetting.cellToolbarLocation); const newConfig = this.togglePosition(viewType, toolbarPosition); - await configurationService.updateValue(CellToolbarLocation, newConfig); + await configurationService.updateValue(NotebookSetting.cellToolbarLocation, newConfig); } } diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.ts b/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.ts index 090e1383270..350e3c7e7d1 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.ts @@ -9,7 +9,7 @@ import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { localize } from 'vs/nls'; import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { CellToolbarLocation, CompactView, ConsolidatedRunButton, FocusIndicator, GlobalToolbar, InsertToolbarLocation, ShowCellStatusBar, UndoRedoPerCell } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService'; import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; @@ -22,34 +22,34 @@ export enum NotebookProfileType { const profiles = { [NotebookProfileType.default]: { - [FocusIndicator]: 'gutter', - [InsertToolbarLocation]: 'both', - [GlobalToolbar]: true, - [CellToolbarLocation]: { default: 'right' }, - [CompactView]: true, - [ShowCellStatusBar]: 'visible', - [ConsolidatedRunButton]: true, - [UndoRedoPerCell]: false + [NotebookSetting.focusIndicator]: 'gutter', + [NotebookSetting.insertToolbarLocation]: 'both', + [NotebookSetting.globalToolbar]: true, + [NotebookSetting.cellToolbarLocation]: { default: 'right' }, + [NotebookSetting.compactView]: true, + [NotebookSetting.showCellStatusBar]: 'visible', + [NotebookSetting.consolidatedRunButton]: true, + [NotebookSetting.undoRedoPerCell]: false }, [NotebookProfileType.jupyter]: { - [FocusIndicator]: 'gutter', - [InsertToolbarLocation]: 'notebookToolbar', - [GlobalToolbar]: true, - [CellToolbarLocation]: { default: 'left' }, - [CompactView]: true, - [ShowCellStatusBar]: 'visible', - [ConsolidatedRunButton]: false, - [UndoRedoPerCell]: true + [NotebookSetting.focusIndicator]: 'gutter', + [NotebookSetting.insertToolbarLocation]: 'notebookToolbar', + [NotebookSetting.globalToolbar]: true, + [NotebookSetting.cellToolbarLocation]: { default: 'left' }, + [NotebookSetting.compactView]: true, + [NotebookSetting.showCellStatusBar]: 'visible', + [NotebookSetting.consolidatedRunButton]: false, + [NotebookSetting.undoRedoPerCell]: true }, [NotebookProfileType.colab]: { - [FocusIndicator]: 'border', - [InsertToolbarLocation]: 'betweenCells', - [GlobalToolbar]: false, - [CellToolbarLocation]: { default: 'right' }, - [CompactView]: false, - [ShowCellStatusBar]: 'hidden', - [ConsolidatedRunButton]: true, - [UndoRedoPerCell]: false + [NotebookSetting.focusIndicator]: 'border', + [NotebookSetting.insertToolbarLocation]: 'betweenCells', + [NotebookSetting.globalToolbar]: false, + [NotebookSetting.cellToolbarLocation]: { default: 'right' }, + [NotebookSetting.compactView]: false, + [NotebookSetting.showCellStatusBar]: 'hidden', + [NotebookSetting.consolidatedRunButton]: true, + [NotebookSetting.undoRedoPerCell]: false } }; @@ -101,13 +101,13 @@ export class NotebookProfileContribution extends Disposable { return; } else { // check if settings are already modified - const focusIndicator = configService.getValue(FocusIndicator); - const insertToolbarPosition = configService.getValue(InsertToolbarLocation); - const globalToolbar = configService.getValue(GlobalToolbar); - // const cellToolbarLocation = configService.getValue(CellToolbarLocation); - const compactView = configService.getValue(CompactView); - const showCellStatusBar = configService.getValue(ShowCellStatusBar); - const consolidatedRunButton = configService.getValue(ConsolidatedRunButton); + const focusIndicator = configService.getValue(NotebookSetting.focusIndicator); + const insertToolbarPosition = configService.getValue(NotebookSetting.insertToolbarLocation); + const globalToolbar = configService.getValue(NotebookSetting.globalToolbar); + // const cellToolbarLocation = configService.getValue(NotebookSetting.cellToolbarLocation); + const compactView = configService.getValue(NotebookSetting.compactView); + const showCellStatusBar = configService.getValue(NotebookSetting.showCellStatusBar); + const consolidatedRunButton = configService.getValue(NotebookSetting.consolidatedRunButton); if (focusIndicator === 'border' && insertToolbarPosition === 'both' && globalToolbar === false diff --git a/src/vs/workbench/contrib/notebook/browser/controller/executeActions.ts b/src/vs/workbench/contrib/notebook/browser/controller/executeActions.ts index 83cdd5c305d..a57d2d97203 100644 --- a/src/vs/workbench/contrib/notebook/browser/controller/executeActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/controller/executeActions.ts @@ -17,7 +17,7 @@ import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cel import { cellExecutionArgs, CellToolbarOrder, CELL_TITLE_CELL_GROUP_ID, executeNotebookCondition, getContextFromActiveEditor, getContextFromUri, INotebookActionContext, INotebookCellActionContext, INotebookCellToolbarActionContext, INotebookCommandContext, NotebookAction, NotebookCellAction, NotebookMultiCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, parseMultiCellExecutionArgs } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID, NOTEBOOK_CELL_EXECUTING, NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_HAS_RUNNING_CELL, NOTEBOOK_INTERRUPTIBLE_KERNEL, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_KERNEL_COUNT, NOTEBOOK_MISSING_KERNEL_EXTENSION } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import * as icons from 'vs/workbench/contrib/notebook/browser/notebookIcons'; -import { CellKind, ConsolidatedRunButton, NotebookCellExecutionState } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { CellKind, NotebookSetting, NotebookCellExecutionState } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -207,7 +207,7 @@ registerAction2(class ExecuteAboveCells extends NotebookMultiCellAction { id: MenuId.NotebookCellExecute, when: ContextKeyExpr.and( executeCondition, - ContextKeyExpr.equals(`config.${ConsolidatedRunButton}`, true)) + ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, true)) }, { id: MenuId.NotebookCellTitle, @@ -215,7 +215,7 @@ registerAction2(class ExecuteAboveCells extends NotebookMultiCellAction { group: CELL_TITLE_CELL_GROUP_ID, when: ContextKeyExpr.and( executeCondition, - ContextKeyExpr.equals(`config.${ConsolidatedRunButton}`, false)) + ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, false)) } ], icon: icons.executeAboveIcon @@ -253,7 +253,7 @@ registerAction2(class ExecuteCellAndBelow extends NotebookMultiCellAction { id: MenuId.NotebookCellExecute, when: ContextKeyExpr.and( executeCondition, - ContextKeyExpr.equals(`config.${ConsolidatedRunButton}`, true)) + ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, true)) }, { id: MenuId.NotebookCellTitle, @@ -261,7 +261,7 @@ registerAction2(class ExecuteCellAndBelow extends NotebookMultiCellAction { group: CELL_TITLE_CELL_GROUP_ID, when: ContextKeyExpr.and( executeCondition, - ContextKeyExpr.equals(`config.${ConsolidatedRunButton}`, false)) + ContextKeyExpr.equals(`config.${NotebookSetting.consolidatedRunButton}`, false)) } ], icon: icons.executeBelowIcon diff --git a/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.ts b/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.ts index c15d0bfb871..c88434cf848 100644 --- a/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.ts @@ -16,7 +16,7 @@ import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cel import { INotebookActionContext, NotebookAction } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_EDITABLE } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel'; -import { CellKind, GlobalToolbarShowLabel } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { CellKind, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; const INSERT_CODE_CELL_ABOVE_COMMAND_ID = 'notebook.cell.insertCodeCellAbove'; const INSERT_CODE_CELL_BELOW_COMMAND_ID = 'notebook.cell.insertCodeCellBelow'; @@ -323,7 +323,7 @@ MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, { NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true), ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells'), ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden'), - ContextKeyExpr.notEquals(`config.${GlobalToolbarShowLabel}`, false) + ContextKeyExpr.notEquals(`config.${NotebookSetting.globalToolbarShowLabel}`, false) ) }); diff --git a/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.ts b/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.ts index c3f39c3cb4e..9e16c29d0e4 100644 --- a/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.ts @@ -13,7 +13,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; import { NOTEBOOK_ACTIONS_CATEGORY } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; -import { OpenGettingStarted } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; @@ -23,7 +23,7 @@ registerAction2(class NotebookConfigureLayoutAction extends Action2 { id: 'workbench.notebook.layout.select', title: localize('workbench.notebook.layout.select.label', "Select between Notebook Layouts"), f1: true, - precondition: ContextKeyExpr.equals(`config.${OpenGettingStarted}`, true), + precondition: ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true), category: NOTEBOOK_ACTIONS_CATEGORY, menu: [ { @@ -32,7 +32,7 @@ registerAction2(class NotebookConfigureLayoutAction extends Action2 { when: ContextKeyExpr.and( NOTEBOOK_IS_ACTIVE_EDITOR, ContextKeyExpr.notEquals('config.notebook.globalToolbar', true), - ContextKeyExpr.equals(`config.${OpenGettingStarted}`, true) + ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true) ), order: 0 }, @@ -41,7 +41,7 @@ registerAction2(class NotebookConfigureLayoutAction extends Action2 { group: 'notebookLayout', when: ContextKeyExpr.and( ContextKeyExpr.equals('config.notebook.globalToolbar', true), - ContextKeyExpr.equals(`config.${OpenGettingStarted}`, true) + ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true) ), order: 0 } diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index d9e3465f648..d70cb4a6b1b 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -30,7 +30,7 @@ import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEd import { isCompositeNotebookEditorInput, NotebookEditorInput, NotebookEditorInputOptions } 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, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookTextDiffEditorPreview, NotebookWorkingCopyTypeIdentifier, ShowCellStatusBar, CompactView, FocusIndicator, InsertToolbarLocation, GlobalToolbar, ConsolidatedOutputButton, ShowFoldingControls, DragAndDropEnabled, NotebookCellEditorOptionsCustomizations, ConsolidatedRunButton, TextOutputLineLimit, GlobalToolbarShowLabel, IOutputItemDto, NotebookMarkupFontSize } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { CellKind, CellUri, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookWorkingCopyTypeIdentifier, NotebookSetting, IOutputItemDto } 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'; @@ -208,7 +208,7 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri ) { super(); - const undoRedoPerCell = configurationService.getValue(UndoRedoPerCell); + const undoRedoPerCell = configurationService.getValue(NotebookSetting.undoRedoPerCell); this._register(undoRedoService.registerUriComparisonKeyComputer(CellUri.scheme, { getComparisonKey: (uri: URI): string => { @@ -656,7 +656,7 @@ configurationRegistry.registerConfiguration({ title: nls.localize('notebookConfigurationTitle', "Notebook"), type: 'object', properties: { - [DisplayOrderKey]: { + [NotebookSetting.displayOrder]: { description: nls.localize('notebook.displayOrder.description', "Priority list for output mime types"), type: ['array'], items: { @@ -664,7 +664,7 @@ configurationRegistry.registerConfiguration({ }, default: [] }, - [CellToolbarLocation]: { + [NotebookSetting.cellToolbarLocation]: { description: nls.localize('notebook.cellToolbarLocation.description', "Where the cell toolbar should be shown, or whether it should be hidden."), type: 'object', additionalProperties: { @@ -677,7 +677,7 @@ configurationRegistry.registerConfiguration({ }, tags: ['notebookLayout'] }, - [ShowCellStatusBar]: { + [NotebookSetting.showCellStatusBar]: { description: nls.localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown."), type: 'string', enum: ['hidden', 'visible', 'visibleAfterExecute'], @@ -688,39 +688,39 @@ configurationRegistry.registerConfiguration({ default: 'visible', tags: ['notebookLayout'] }, - [NotebookTextDiffEditorPreview]: { + [NotebookSetting.textDiffEditorPreview]: { description: nls.localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [CellToolbarVisibility]: { + [NotebookSetting.cellToolbarVisibility]: { markdownDescription: nls.localize('notebook.cellToolbarVisibility.description', "Whether the cell toolbar should appear on hover or click."), type: 'string', enum: ['hover', 'click'], default: 'click', tags: ['notebookLayout'] }, - [UndoRedoPerCell]: { + [NotebookSetting.undoRedoPerCell]: { description: nls.localize('notebook.undoRedoPerCell.description', "Whether to use separate undo/redo stack for each cell."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [CompactView]: { + [NotebookSetting.compactView]: { description: nls.localize('notebook.compactView.description', "Control whether the notebook editor should be rendered in a compact form. For example, when turned on, it will decrease the left margin width."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [FocusIndicator]: { + [NotebookSetting.focusIndicator]: { description: nls.localize('notebook.focusIndicator.description', "Controls where the focus indicator is rendered, either along the cell borders or on the left gutter"), type: 'string', enum: ['border', 'gutter'], default: 'gutter', tags: ['notebookLayout'] }, - [InsertToolbarLocation]: { + [NotebookSetting.insertToolbarLocation]: { description: nls.localize('notebook.insertToolbarPosition.description', "Control where the insert cell actions should appear."), type: 'string', enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'], @@ -733,19 +733,19 @@ configurationRegistry.registerConfiguration({ default: 'both', tags: ['notebookLayout'] }, - [GlobalToolbar]: { + [NotebookSetting.globalToolbar]: { description: nls.localize('notebook.globalToolbar.description', "Control whether to render a global toolbar inside the notebook editor."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [ConsolidatedOutputButton]: { + [NotebookSetting.consolidatedOutputButton]: { description: nls.localize('notebook.consolidatedOutputButton.description', "Control whether outputs action should be rendered in the output toolbar."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [ShowFoldingControls]: { + [NotebookSetting.showFoldingControls]: { description: nls.localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown."), type: 'string', enum: ['always', 'mouseover'], @@ -756,36 +756,36 @@ configurationRegistry.registerConfiguration({ default: 'mouseover', tags: ['notebookLayout'] }, - [DragAndDropEnabled]: { + [NotebookSetting.dragAndDropEnabled]: { description: nls.localize('notebook.dragAndDrop.description', "Control whether the notebook editor should allow moving cells through drag and drop."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [ConsolidatedRunButton]: { + [NotebookSetting.consolidatedRunButton]: { description: nls.localize('notebook.consolidatedRunButton.description', "Control whether extra actions are shown in a dropdown next to the run button."), type: 'boolean', default: false, tags: ['notebookLayout'] }, - [GlobalToolbarShowLabel]: { + [NotebookSetting.globalToolbarShowLabel]: { description: nls.localize('notebook.globalToolbarShowLabel', "Control whether the actions on the notebook toolbar should render label or not."), type: 'boolean', default: true, tags: ['notebookLayout'] }, - [TextOutputLineLimit]: { + [NotebookSetting.textOutputLineLimit]: { description: nls.localize('notebook.textOutputLineLimit', "Control how many lines of text in a text output is rendered."), type: 'number', default: 30, tags: ['notebookLayout'] }, - [NotebookMarkupFontSize]: { + [NotebookSetting.markupFontSize]: { markdownDescription: nls.localize('notebook.markup.fontSize', "Controls the font size of rendered markup in notebooks. When set to `0`, the value of `#editor.fontSize#` is used."), type: 'number', default: 0, tags: ['notebookLayout'] }, - [NotebookCellEditorOptionsCustomizations]: editorOptionsCustomizationSchema + [NotebookSetting.cellEditorOptionsCustomizations]: editorOptionsCustomizationSchema } }); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index c1fd60d25a2..6f309a54847 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -30,7 +30,7 @@ import { INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/no import { NotebookDiffEditorInput } from 'vs/workbench/contrib/notebook/browser/notebookDiffEditorInput'; import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; -import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellUri, DisplayOrderKey, INotebookContributionData, INotebookExclusiveDocumentFilter, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IOutputDto, MimeTypeDisplayOrder, mimeTypeIsAlwaysSecure, mimeTypeSupportedByCore, NotebookData, NotebookEditorPriority, NotebookRendererMatch, NotebookTextDiffEditorPreview, NOTEBOOK_DISPLAY_ORDER, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, TransientOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellUri, NotebookSetting, INotebookContributionData, INotebookExclusiveDocumentFilter, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IOutputDto, MimeTypeDisplayOrder, mimeTypeIsAlwaysSecure, mimeTypeSupportedByCore, NotebookData, NotebookEditorPriority, NotebookRendererMatch, NOTEBOOK_DISPLAY_ORDER, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, TransientOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput'; import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService'; import { updateEditorTopPadding } from 'vs/workbench/contrib/notebook/common/notebookOptions'; @@ -161,7 +161,7 @@ export class NotebookProviderInfoStore extends Disposable { priority: notebookProviderInfo.exclusive ? RegisteredEditorPriority.exclusive : notebookProviderInfo.priority, }; const notebookEditorOptions = { - canHandleDiff: () => !!this._configurationService.getValue(NotebookTextDiffEditorPreview) && !this._accessibilityService.isScreenReaderOptimized(), + canHandleDiff: () => !!this._configurationService.getValue(NotebookSetting.textDiffEditorPreview) && !this._accessibilityService.isScreenReaderOptimized(), canSupportResource: (resource: URI) => resource.scheme === Schemas.untitled || resource.scheme === Schemas.vscodeNotebookCell || this._fileService.hasProvider(resource) }; const notebookEditorInputFactory: EditorInputFactoryFunction = ({ resource, options }) => { @@ -458,7 +458,7 @@ export class NotebookService extends Disposable implements INotebookService { const updateOrder = () => { this._displayOrder = new MimeTypeDisplayOrder( - this._configurationService.getValue(DisplayOrderKey) || [], + this._configurationService.getValue(NotebookSetting.displayOrder) || [], this._accessibilityService.isScreenReaderOptimized() ? ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER : NOTEBOOK_DISPLAY_ORDER, @@ -468,7 +468,7 @@ export class NotebookService extends Disposable implements INotebookService { updateOrder(); this._register(this._configurationService.onDidChangeConfiguration(e => { - if (e.affectedKeys.indexOf(DisplayOrderKey) >= 0) { + if (e.affectedKeys.indexOf(NotebookSetting.displayOrder) >= 0) { updateOrder(); } })); @@ -626,7 +626,7 @@ export class NotebookService extends Disposable implements INotebookService { } saveMimeDisplayOrder(target: ConfigurationTarget) { - this._configurationService.updateValue(DisplayOrderKey, this._displayOrder.toArray(), target); + this._configurationService.updateValue(NotebookSetting.displayOrder, this._displayOrder.toArray(), target); } getRenderers(): INotebookRendererInfo[] { diff --git a/src/vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform.ts b/src/vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform.ts index 5d0fcbd0a2a..57f448967a6 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform.ts @@ -18,7 +18,7 @@ import { ICellOutputViewModel, IRenderOutput, RenderOutputType } from 'vs/workbe import { INotebookDelegateForOutput, IOutputTransformContribution as IOutputRendererContribution } from 'vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon'; import { OutputRendererRegistry } from 'vs/workbench/contrib/notebook/browser/view/output/rendererRegistry'; import { truncatedArrayOfString } from 'vs/workbench/contrib/notebook/browser/view/output/transforms/textHelper'; -import { IOutputItemDto, TextOutputLineLimit } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { IOutputItemDto, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; class JavaScriptRendererContrib extends Disposable implements IOutputRendererContribution { @@ -74,7 +74,7 @@ class StreamRendererContrib extends Disposable implements IOutputRendererContrib const text = getStringValue(item); const contentNode = DOM.$('span.output-stream'); - const lineLimit = this.configurationService.getValue(TextOutputLineLimit) ?? 30; + const lineLimit = this.configurationService.getValue(NotebookSetting.textOutputLineLimit) ?? 30; truncatedArrayOfString(notebookUri, output.cellViewModel, Math.max(lineLimit, 6), contentNode, [text], disposables, linkDetector, this.openerService, this.themeService); container.appendChild(contentNode); @@ -178,7 +178,7 @@ class PlainTextRendererContrib extends Disposable implements IOutputRendererCont const str = getStringValue(item); const contentNode = DOM.$('.output-plaintext'); - const lineLimit = this.configurationService.getValue(TextOutputLineLimit) ?? 30; + const lineLimit = this.configurationService.getValue(NotebookSetting.textOutputLineLimit) ?? 30; truncatedArrayOfString(notebookUri, output.cellViewModel, Math.max(lineLimit, 6), contentNode, [str], disposables, linkDetector, this.openerService, this.themeService); container.appendChild(contentNode); diff --git a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.ts b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.ts index 8e1f4b086e7..2a32670df98 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.ts @@ -23,7 +23,7 @@ import { SELECT_KERNEL_ID } from 'vs/workbench/contrib/notebook/browser/controll import { INotebookEditorDelegate, NOTEBOOK_EDITOR_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { NotebooKernelActionViewItem } from 'vs/workbench/contrib/notebook/browser/viewParts/notebookKernelActionViewItem'; import { ActionViewWithLabel } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellActionView'; -import { GlobalToolbarShowLabel } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService'; import { NotebookOptions } from 'vs/workbench/contrib/notebook/common/notebookOptions'; @@ -114,7 +114,7 @@ export class NotebookEditorToolbar extends Disposable { this._register(this._notebookGlobalActionsMenu); this._useGlobalToolbar = this.notebookOptions.getLayoutConfiguration().globalToolbar; - this._renderLabel = this.configurationService.getValue(GlobalToolbarShowLabel); + this._renderLabel = this.configurationService.getValue(NotebookSetting.globalToolbarShowLabel); const context = { ui: true, @@ -184,8 +184,8 @@ export class NotebookEditorToolbar extends Disposable { })); this._register(this.configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration(GlobalToolbarShowLabel)) { - this._renderLabel = this.configurationService.getValue(GlobalToolbarShowLabel); + if (e.affectsConfiguration(NotebookSetting.globalToolbarShowLabel)) { + this._renderLabel = this.configurationService.getValue(NotebookSetting.globalToolbarShowLabel); const oldElement = this._notebookLeftToolbar.getElement(); oldElement.parentElement?.removeChild(oldElement); this._notebookLeftToolbar.dispose(); diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index 454d082a718..c495315f175 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -901,27 +901,30 @@ export interface INotebookCellStatusBarItemList { dispose?(): void; } -export const DisplayOrderKey = 'notebook.displayOrder'; -export const CellToolbarLocation = 'notebook.cellToolbarLocation'; -export const CellToolbarVisibility = 'notebook.cellToolbarVisibility'; export type ShowCellStatusBarType = 'hidden' | 'visible' | 'visibleAfterExecute'; -export const ShowCellStatusBar = 'notebook.showCellStatusBar'; -export const NotebookTextDiffEditorPreview = 'notebook.diff.enablePreview'; -export const ExperimentalInsertToolbarAlignment = 'notebook.experimental.insertToolbarAlignment'; -export const CompactView = 'notebook.compactView'; -export const FocusIndicator = 'notebook.cellFocusIndicator'; -export const InsertToolbarLocation = 'notebook.insertToolbarLocation'; -export const GlobalToolbar = 'notebook.globalToolbar'; -export const UndoRedoPerCell = 'notebook.undoRedoPerCell'; -export const ConsolidatedOutputButton = 'notebook.consolidatedOutputButton'; -export const ShowFoldingControls = 'notebook.showFoldingControls'; -export const DragAndDropEnabled = 'notebook.dragAndDropEnabled'; -export const NotebookCellEditorOptionsCustomizations = 'notebook.editorOptionsCustomizations'; -export const ConsolidatedRunButton = 'notebook.consolidatedRunButton'; -export const OpenGettingStarted = 'notebook.experimental.openGettingStarted'; -export const TextOutputLineLimit = 'notebook.output.textLineLimit'; -export const GlobalToolbarShowLabel = 'notebook.globalToolbarShowLabel'; -export const NotebookMarkupFontSize = 'notebook.markup.fontSize'; + +export const NotebookSetting = { + displayOrder: 'notebook.displayOrder', + cellToolbarLocation: 'notebook.cellToolbarLocation', + cellToolbarVisibility: 'notebook.cellToolbarVisibility', + showCellStatusBar: 'notebook.showCellStatusBar', + textDiffEditorPreview: 'notebook.diff.enablePreview', + experimentalInsertToolbarAlignment: 'notebook.experimental.insertToolbarAlignment', + compactView: 'notebook.compactView', + focusIndicator: 'notebook.cellFocusIndicator', + insertToolbarLocation: 'notebook.insertToolbarLocation', + globalToolbar: 'notebook.globalToolbar', + undoRedoPerCell: 'notebook.undoRedoPerCell', + consolidatedOutputButton: 'notebook.consolidatedOutputButton', + showFoldingControls: 'notebook.showFoldingControls', + dragAndDropEnabled: 'notebook.dragAndDropEnabled', + cellEditorOptionsCustomizations: 'notebook.editorOptionsCustomizations', + consolidatedRunButton: 'notebook.consolidatedRunButton', + openGettingStarted: 'notebook.experimental.openGettingStarted', + textOutputLineLimit: 'notebook.output.textLineLimit', + globalToolbarShowLabel: 'notebook.globalToolbarShowLabel', + markupFontSize: 'notebook.markup.fontSize', +} as const; export const enum CellStatusbarAlignment { Left = 1, diff --git a/src/vs/workbench/contrib/notebook/common/notebookOptions.ts b/src/vs/workbench/contrib/notebook/common/notebookOptions.ts index f8dd24f3b84..1c848245cac 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookOptions.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookOptions.ts @@ -6,7 +6,7 @@ import { Emitter } from 'vs/base/common/event'; import { Disposable } 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, NotebookCellInternalMetadata, NotebookMarkupFontSize, ShowCellStatusBar, ShowCellStatusBarType, ShowFoldingControls } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookCellInternalMetadata, NotebookSetting, ShowCellStatusBarType } from 'vs/workbench/contrib/notebook/common/notebookCommon'; const SCROLLABLE_ELEMENT_PADDING_TOP = 18; @@ -111,22 +111,22 @@ export class NotebookOptions extends Disposable { constructor(private readonly configurationService: IConfigurationService, private readonly overrides?: { cellToolbarInteraction: string, globalToolbar: boolean }) { super(); - const showCellStatusBar = this.configurationService.getValue(ShowCellStatusBar); - const globalToolbar = overrides?.globalToolbar ?? this.configurationService.getValue(GlobalToolbar) ?? true; - const consolidatedOutputButton = this.configurationService.getValue(ConsolidatedOutputButton) ?? true; - const consolidatedRunButton = this.configurationService.getValue(ConsolidatedRunButton) ?? false; - const dragAndDropEnabled = this.configurationService.getValue(DragAndDropEnabled) ?? true; - const cellToolbarLocation = this.configurationService.getValue(CellToolbarLocation) ?? { 'default': 'right' }; - const cellToolbarInteraction = overrides?.cellToolbarInteraction ?? this.configurationService.getValue(CellToolbarVisibility); - const compactView = this.configurationService.getValue(CompactView) ?? true; + const showCellStatusBar = this.configurationService.getValue(NotebookSetting.showCellStatusBar); + const globalToolbar = overrides?.globalToolbar ?? this.configurationService.getValue(NotebookSetting.globalToolbar) ?? true; + const consolidatedOutputButton = this.configurationService.getValue(NotebookSetting.consolidatedOutputButton) ?? true; + const consolidatedRunButton = this.configurationService.getValue(NotebookSetting.consolidatedRunButton) ?? false; + const dragAndDropEnabled = this.configurationService.getValue(NotebookSetting.dragAndDropEnabled) ?? true; + const cellToolbarLocation = this.configurationService.getValue(NotebookSetting.cellToolbarLocation) ?? { 'default': 'right' }; + const cellToolbarInteraction = overrides?.cellToolbarInteraction ?? this.configurationService.getValue(NotebookSetting.cellToolbarVisibility); + const compactView = this.configurationService.getValue(NotebookSetting.compactView) ?? true; const focusIndicator = this._computeFocusIndicatorOption(); const insertToolbarPosition = this._computeInsertToolbarPositionOption(); const insertToolbarAlignment = this._computeInsertToolbarAlignmentOption(); const showFoldingControls = this._computeShowFoldingControlsOption(); // const { bottomToolbarGap, bottomToolbarHeight } = this._computeBottomToolbarDimensions(compactView, insertToolbarPosition, insertToolbarAlignment); const fontSize = this.configurationService.getValue('editor.fontSize'); - const markupFontSize = this.configurationService.getValue(NotebookMarkupFontSize); - const editorOptionsCustomizations = this.configurationService.getValue(NotebookCellEditorOptionsCustomizations); + const markupFontSize = this.configurationService.getValue(NotebookSetting.markupFontSize); + const editorOptionsCustomizations = this.configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations); this._layoutConfiguration = { ...(compactView ? compactConfigConstants : defaultConfigConstants), @@ -173,21 +173,21 @@ export class NotebookOptions extends Disposable { } private _updateConfiguration(e: IConfigurationChangeEvent) { - const cellStatusBarVisibility = e.affectsConfiguration(ShowCellStatusBar); - const cellToolbarLocation = e.affectsConfiguration(CellToolbarLocation); - const cellToolbarInteraction = e.affectsConfiguration(CellToolbarVisibility); - const compactView = e.affectsConfiguration(CompactView); - const focusIndicator = e.affectsConfiguration(FocusIndicator); - const insertToolbarPosition = e.affectsConfiguration(InsertToolbarLocation); - const insertToolbarAlignment = e.affectsConfiguration(ExperimentalInsertToolbarAlignment); - const globalToolbar = e.affectsConfiguration(GlobalToolbar); - const consolidatedOutputButton = e.affectsConfiguration(ConsolidatedOutputButton); - const consolidatedRunButton = e.affectsConfiguration(ConsolidatedRunButton); - const showFoldingControls = e.affectsConfiguration(ShowFoldingControls); - const dragAndDropEnabled = e.affectsConfiguration(DragAndDropEnabled); + const cellStatusBarVisibility = e.affectsConfiguration(NotebookSetting.showCellStatusBar); + const cellToolbarLocation = e.affectsConfiguration(NotebookSetting.cellToolbarLocation); + const cellToolbarInteraction = e.affectsConfiguration(NotebookSetting.cellToolbarVisibility); + const compactView = e.affectsConfiguration(NotebookSetting.compactView); + const focusIndicator = e.affectsConfiguration(NotebookSetting.focusIndicator); + const insertToolbarPosition = e.affectsConfiguration(NotebookSetting.insertToolbarLocation); + const insertToolbarAlignment = e.affectsConfiguration(NotebookSetting.experimentalInsertToolbarAlignment); + const globalToolbar = e.affectsConfiguration(NotebookSetting.globalToolbar); + const consolidatedOutputButton = e.affectsConfiguration(NotebookSetting.consolidatedOutputButton); + const consolidatedRunButton = e.affectsConfiguration(NotebookSetting.consolidatedRunButton); + const showFoldingControls = e.affectsConfiguration(NotebookSetting.showFoldingControls); + const dragAndDropEnabled = e.affectsConfiguration(NotebookSetting.dragAndDropEnabled); const fontSize = e.affectsConfiguration('editor.fontSize'); - const markupFontSize = e.affectsConfiguration(NotebookMarkupFontSize); - const editorOptionsCustomizations = e.affectsConfiguration(NotebookCellEditorOptionsCustomizations); + const markupFontSize = e.affectsConfiguration(NotebookSetting.markupFontSize); + const editorOptionsCustomizations = e.affectsConfiguration(NotebookSetting.cellEditorOptionsCustomizations); if ( !cellStatusBarVisibility @@ -211,15 +211,15 @@ export class NotebookOptions extends Disposable { let configuration = Object.assign({}, this._layoutConfiguration); if (cellStatusBarVisibility) { - configuration.showCellStatusBar = this.configurationService.getValue(ShowCellStatusBar); + configuration.showCellStatusBar = this.configurationService.getValue(NotebookSetting.showCellStatusBar); } if (cellToolbarLocation) { - configuration.cellToolbarLocation = this.configurationService.getValue(CellToolbarLocation) ?? { 'default': 'right' }; + configuration.cellToolbarLocation = this.configurationService.getValue(NotebookSetting.cellToolbarLocation) ?? { 'default': 'right' }; } if (cellToolbarInteraction && !this.overrides?.cellToolbarInteraction) { - configuration.cellToolbarInteraction = this.configurationService.getValue(CellToolbarVisibility); + configuration.cellToolbarInteraction = this.configurationService.getValue(NotebookSetting.cellToolbarVisibility); } if (focusIndicator) { @@ -227,7 +227,7 @@ export class NotebookOptions extends Disposable { } if (compactView) { - const compactViewValue = this.configurationService.getValue(CompactView) ?? true; + const compactViewValue = this.configurationService.getValue(NotebookSetting.compactView) ?? true; configuration = Object.assign(configuration, { ...(compactViewValue ? compactConfigConstants : defaultConfigConstants), }); @@ -243,15 +243,15 @@ export class NotebookOptions extends Disposable { } if (globalToolbar && this.overrides?.globalToolbar === undefined) { - configuration.globalToolbar = this.configurationService.getValue(GlobalToolbar) ?? true; + configuration.globalToolbar = this.configurationService.getValue(NotebookSetting.globalToolbar) ?? true; } if (consolidatedOutputButton) { - configuration.consolidatedOutputButton = this.configurationService.getValue(ConsolidatedOutputButton) ?? true; + configuration.consolidatedOutputButton = this.configurationService.getValue(NotebookSetting.consolidatedOutputButton) ?? true; } if (consolidatedRunButton) { - configuration.consolidatedRunButton = this.configurationService.getValue(ConsolidatedRunButton) ?? true; + configuration.consolidatedRunButton = this.configurationService.getValue(NotebookSetting.consolidatedRunButton) ?? true; } if (showFoldingControls) { @@ -259,7 +259,7 @@ export class NotebookOptions extends Disposable { } if (dragAndDropEnabled) { - configuration.dragAndDropEnabled = this.configurationService.getValue(DragAndDropEnabled) ?? true; + configuration.dragAndDropEnabled = this.configurationService.getValue(NotebookSetting.dragAndDropEnabled) ?? true; } if (fontSize) { @@ -267,11 +267,11 @@ export class NotebookOptions extends Disposable { } if (markupFontSize) { - configuration.markupFontSize = this.configurationService.getValue(NotebookMarkupFontSize) || configuration.fontSize; + configuration.markupFontSize = this.configurationService.getValue(NotebookSetting.markupFontSize) || configuration.fontSize; } if (editorOptionsCustomizations) { - configuration.editorOptionsCustomizations = this.configurationService.getValue(NotebookCellEditorOptionsCustomizations); + configuration.editorOptionsCustomizations = this.configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations); } this._layoutConfiguration = Object.freeze(configuration); @@ -297,19 +297,19 @@ export class NotebookOptions extends Disposable { } private _computeInsertToolbarPositionOption() { - return this.configurationService.getValue<'betweenCells' | 'notebookToolbar' | 'both' | 'hidden'>(InsertToolbarLocation) ?? 'both'; + return this.configurationService.getValue<'betweenCells' | 'notebookToolbar' | 'both' | 'hidden'>(NotebookSetting.insertToolbarLocation) ?? 'both'; } private _computeInsertToolbarAlignmentOption() { - return this.configurationService.getValue<'left' | 'center'>(ExperimentalInsertToolbarAlignment) ?? 'center'; + return this.configurationService.getValue<'left' | 'center'>(NotebookSetting.experimentalInsertToolbarAlignment) ?? 'center'; } private _computeShowFoldingControlsOption() { - return this.configurationService.getValue<'always' | 'mouseover'>(ShowFoldingControls) ?? 'mouseover'; + return this.configurationService.getValue<'always' | 'mouseover'>(NotebookSetting.showFoldingControls) ?? 'mouseover'; } private _computeFocusIndicatorOption() { - return this.configurationService.getValue<'border' | 'gutter'>(FocusIndicator) ?? 'gutter'; + return this.configurationService.getValue<'border' | 'gutter'>(NotebookSetting.focusIndicator) ?? 'gutter'; } getLayoutConfiguration(): NotebookLayoutConfiguration { diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/common/gettingStartedContent.ts b/src/vs/workbench/contrib/welcome/gettingStarted/common/gettingStartedContent.ts index 62c5ac5b7fb..2218e71c907 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/common/gettingStartedContent.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/common/gettingStartedContent.ts @@ -9,7 +9,7 @@ import { localize } from 'vs/nls'; import { Codicon } from 'vs/base/common/codicons'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { registerIcon } from 'vs/platform/theme/common/iconRegistry'; -import { OpenGettingStarted } from 'vs/workbench/contrib/notebook/common/notebookCommon'; +import { NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; const setupIcon = registerIcon('getting-started-setup', Codicon.zap, localize('getting-started-setup-icon', "Icon used for the setup category of welcome page")); @@ -483,7 +483,7 @@ export const walkthroughs: GettingStartedWalkthroughContent = [ description: '', icon: setupIcon, isFeatured: false, - when: `config.${OpenGettingStarted} && userHasOpenedNotebook`, + when: `config.${NotebookSetting.openGettingStarted} && userHasOpenedNotebook`, content: { type: 'steps', steps: [