Enable VS Code notebooks with a built-in SQL kernel. (#21995)

This commit is contained in:
Cory Rivera
2023-02-23 16:22:46 -08:00
committed by GitHub
parent 290687a207
commit f53119c2a6
66 changed files with 4962 additions and 318 deletions

View File

@@ -67,3 +67,28 @@ export const terminalIntegratedEnvOsxDescription = localize('terminal.integrated
export const terminalIntegratedEnvLinuxDescription = localize('terminal.integrated.env.linux', "Object with environment variables that will be added to the Azure Data Studio process to be used by the terminal on Linux. Set to `null` to delete the environment variable.")
export const terminalIntegratedEnvWindowsDescription = localize('terminal.integrated.env.windows', "Object with environment variables that will be added to the Azure Data Studio process to be used by the terminal on Windows. Set to `null` to delete the environment variable.")
export const terminalIntegratedInheritEnvDescription = localize('terminal.integrated.inheritEnv', "Whether new shells should inherit their environment from Azure Data Studio, which may source a login shell to ensure $PATH and other development variables are initialized. This has no effect on Windows.")
//#region VS Code Notebook settings
export const displayOrderDescription = localize('notebook.displayOrder.description', "Priority list for output mime types. (for VS Code Notebooks only)");
export const cellToolbarLocationDescription = localize('notebook.cellToolbarLocation.description', "Where the cell toolbar should be shown, or whether it should be hidden. (for VS Code Notebooks only)");
export const showCellStatusbarDescription = localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown. (for VS Code Notebooks only)");
export const diffEnablePreviewDescription = localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook. (for VS Code Notebooks only)");
export const cellToolbarVisibilityDescription = localize('notebook.cellToolbarVisibility.description', "Whether the cell toolbar should appear on hover or click. (for VS Code Notebooks only)");
export const undoRedoPerCellDescription = localize('notebook.undoRedoPerCell.description', "Whether to use separate undo/redo stack for each cell. (for VS Code Notebooks only)");
export const compactViewDescription = 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. (for VS Code Notebooks only)");
export const focusIndicatorDescription = localize('notebook.focusIndicator.description', "Controls where the focus indicator is rendered, either along the cell borders or on the left gutter. (for VS Code Notebooks only)");
export const insertToolbarPositionDescription = localize('notebook.insertToolbarPosition.description', "Control where the insert cell actions should appear. (for VS Code Notebooks only)");
export const globalToolbarDescription = localize('notebook.globalToolbar.description', "Control whether to render a global toolbar inside the notebook editor. (for VS Code Notebooks only)");
export const consolidatedOutputButtonDescription = localize('notebook.consolidatedOutputButton.description', "Control whether outputs action should be rendered in the output toolbar. (for VS Code Notebooks only)");
export const showFoldingControlsDescription = localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown. (for VS Code Notebooks only)");
export const dragAndDropDescription = localize('notebook.dragAndDrop.description', "Control whether the notebook editor should allow moving cells through drag and drop. (for VS Code Notebooks only)");
export const consolidatedRunButtonDescription = localize('notebook.consolidatedRunButton.description', "Control whether extra actions are shown in a dropdown next to the run button. (for VS Code Notebooks only)");
export const globalToolbarShowLabelDescription = localize('notebook.globalToolbarShowLabel', "Control whether the actions on the notebook toolbar should render label or not. (for VS Code Notebooks only)");
export const textOutputLineLimitDescription = localize('notebook.textOutputLineLimit', "Control how many lines of text in a text output is rendered. (for VS Code Notebooks only)");
export const markupFontSizeDescription = localize('notebook.markup.fontSize', "Controls the font size in pixels of rendered markup in notebooks. When set to `0`, 120% of `#editor.fontSize#` is used. (for VS Code Notebooks only)");
export const interactiveWindowCollapseCodeCellsDescription = localize('notebook.interactiveWindow.collapseCodeCells', "Controls whether code cells in the interactive window are collapsed by default. (for VS Code Notebooks only)");
export const outputLineHeightDescription = localize('notebook.outputLineHeight', "Line height of the output text for notebook cells.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values. (for VS Code Notebooks only)");
export const outputFontSizeDescription = localize('notebook.outputFontSize', "Font size for the output text for notebook cells. When set to 0 `#editor.fontSize#` is used. (for VS Code Notebooks only)");
export const outputFontFamilyDescription = localize('notebook.outputFontFamily', "The font family for the output text for notebook cells. When set to empty, the `#editor.fontFamily#` is used. (for VS Code Notebooks only)");
export const experimentalCustomizationDescription = localize('notebook.editorOptions.experimentalCustomization', 'Settings for code editors used in notebooks. This can be used to customize most editor.* settings. (for VS Code Notebooks only)');
//#endregion

View File

@@ -727,7 +727,7 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
$listDatabases(connectionId: string): Thenable<string[]>;
$getConnectionString(connectionId: string, includePassword: boolean): Thenable<string>;
$getUriForConnection(connectionId: string): Thenable<string>;
$connect(connectionProfile: azdata.IConnectionProfile, saveConnection: boolean, showDashboard: boolean): Thenable<azdata.ConnectionResult>;
$connect(connectionProfile: azdata.IConnectionProfile, saveConnection: boolean, showDashboard: boolean, ownerUri?: string): Thenable<azdata.ConnectionResult>;
}
export interface MainThreadCredentialManagementShape extends IDisposable {

View File

@@ -51,3 +51,16 @@ Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConf
}
}
});
Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConfiguration({
'id': 'useVSCodeNotebooks',
'title': nls.localize('useVSCodeNotebooksTitle', "Use VS Code notebooks"),
'type': 'object',
'properties': {
'workbench.useVSCodeNotebooks': {
'type': 'boolean',
'default': false,
'description': nls.localize('useVSCodeNotebooks', "(Preview) Use VS Code notebooks as the default notebook experience. Note: Azure Data Studio will need to be restarted to enable this setting.")
}
}
});

View File

@@ -27,6 +27,7 @@ export const ToggleRegexCommandId = 'toggleSearchRegex';
export const AddCursorsAtSearchResults = 'addCursorsAtSearchResults';
export const CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES = 'workbench.enablePreviewFeatures';
export const CONFIG_WORKBENCH_USEVSCODENOTEBOOKS = 'workbench.useVSCodeNotebooks';
export const SearchViewFocusedKey = new RawContextKey<boolean>('notebookSearchViewletFocus', false);
export const InputBoxFocusedKey = new RawContextKey<boolean>('inputBoxFocus', false);

View File

@@ -37,6 +37,8 @@ import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { KernelsLanguage } from 'sql/workbench/services/notebook/common/notebookConstants';
import { INotebookViews } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
import { Schemas } from 'vs/base/common/network';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, CONFIG_WORKBENCH_USEVSCODENOTEBOOKS } from 'sql/workbench/common/constants';
import { ICommandService } from 'vs/platform/commands/common/commands';
const msgLoading = localize('loading', "Loading kernels...");
export const msgChanging = localize('changing', "Changing kernel...");
@@ -844,6 +846,8 @@ export class NewNotebookAction extends Action {
@IObjectExplorerService private objectExplorerService: IObjectExplorerService,
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
@INotebookService private _notebookService: INotebookService,
@IConfigurationService private _configurationService: IConfigurationService,
@ICommandService private _commandService: ICommandService,
) {
super(id, label);
this.class = 'notebook-action new-notebook';
@@ -853,14 +857,21 @@ export class NewNotebookAction extends Action {
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Notebook, TelemetryKeys.NbTelemetryAction.NewNotebookFromConnections)
.withConnectionInfo(context?.connectionProfile)
.send();
let connProfile: azdata.IConnectionProfile;
if (context && context.nodeInfo) {
let node = await this.objectExplorerService.getTreeNode(context.connectionProfile.id, context.nodeInfo.nodePath);
connProfile = TreeUpdateUtils.getConnectionProfile(node).toIConnectionProfile();
} else if (context && context.connectionProfile) {
connProfile = context.connectionProfile;
const usePreviewFeatures = this._configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
const useVSCodeNotebooks = this._configurationService.getValue(CONFIG_WORKBENCH_USEVSCODENOTEBOOKS);
if (usePreviewFeatures && useVSCodeNotebooks) {
await this._commandService.executeCommand('ipynb.newUntitledIpynb');
} else {
let connProfile: azdata.IConnectionProfile;
if (context && context.nodeInfo) {
let node = await this.objectExplorerService.getTreeNode(context.connectionProfile.id, context.nodeInfo.nodePath);
connProfile = TreeUpdateUtils.getConnectionProfile(node).toIConnectionProfile();
} else if (context && context.connectionProfile) {
connProfile = context.connectionProfile;
}
await this._notebookService.openNotebook(URI.from({ scheme: 'untitled' }), { connectionProfile: connProfile });
}
await this._notebookService.openNotebook(URI.from({ scheme: 'untitled' }), { connectionProfile: connProfile });
}
}

View File

@@ -9,18 +9,18 @@ import { Emitter } from 'vs/base/common/event';
import { DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; // {{SQL CARBON EDIT}} Remove unused
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
import { INotebookCellStatusBarItemProvider, INotebookContributionData, NotebookData as NotebookData, NotebookExtensionDescription, TransientCellMetadata, TransientDocumentMetadata, TransientOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookContentProvider, INotebookService, SimpleNotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookService';
import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { ExtHostContext, ExtHostNotebookShape, MainThreadNotebookShape } from '../common/extHost.protocol'; // {{SQL CARBON EDIT}} Remove unused
import { ExtHostContext, ExtHostNotebookShape, MainContext, MainThreadNotebookShape } from '../common/extHost.protocol';
import { ILogService } from 'vs/platform/log/common/log';
import { StopWatch } from 'vs/base/common/stopwatch';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { assertType } from 'vs/base/common/types';
// @extHostNamedCustomer(MainContext.MainThreadNotebook) {{SQL CARBON EDIT}} Disable VS Code notebooks
@extHostNamedCustomer(MainContext.MainThreadNotebook)
export class MainThreadNotebooks implements MainThreadNotebookShape {
private readonly _disposables = new DisposableStore();
@@ -196,7 +196,7 @@ CommandsRegistry.registerCommand('_executeDataToNotebook', async (accessor, ...a
const notebookService = accessor.get(INotebookService);
const info = await notebookService.withNotebookDataProvider(notebookType);
if (!(info instanceof SimpleNotebookProviderInfo)) {
return undefined;
return undefined; // {{SQL CARBON EDIT}} strict nulls
}
const dto = await info.serializer.dataToNotebook(bytes);
@@ -212,7 +212,7 @@ CommandsRegistry.registerCommand('_executeNotebookToData', async (accessor, ...a
const notebookService = accessor.get(INotebookService);
const info = await notebookService.withNotebookDataProvider(notebookType);
if (!(info instanceof SimpleNotebookProviderInfo)) {
return undefined;
return undefined; // {{SQL CARBON EDIT}} strict nulls
}
const data = NotebookDto.fromNotebookDataDto(dto.value);

View File

@@ -10,7 +10,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { MainThreadNotebookDocuments } from 'vs/workbench/api/browser/mainThreadNotebookDocuments';
import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto';
import { MainThreadNotebookEditors } from 'vs/workbench/api/browser/mainThreadNotebookEditors';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { extHostCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { editorGroupToColumn } from 'vs/workbench/services/editor/common/editorGroupColumn';
import { getNotebookEditorFromEditorPane, IActiveNotebookEditor, INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/notebookEditorService';
@@ -69,7 +69,7 @@ class NotebookAndEditorState {
}
}
// @extHostCustomer {{SQL CARBON EDIT}} Disable VS Code notebooks
@extHostCustomer
export class MainThreadNotebooksAndEditors {
// private readonly _onDidAddNotebooks = new Emitter<NotebookTextModel[]>();

View File

@@ -11,13 +11,13 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import { ILanguageService } from 'vs/editor/common/languages/language';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto';
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/notebookEditorService';
import { INotebookCellExecution, INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService';
import { IResolvedNotebookKernel, INotebookKernelChangeEvent, INotebookKernelService, NotebookKernelType } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { ExtHostContext, ExtHostNotebookKernelsShape, ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainThreadNotebookKernelsShape } from '../common/extHost.protocol';
import { ExtHostContext, ExtHostNotebookKernelsShape, ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainContext, MainThreadNotebookKernelsShape } from '../common/extHost.protocol';
abstract class MainThreadKernel implements IResolvedNotebookKernel {
readonly type: NotebookKernelType.Resolved = NotebookKernelType.Resolved;
@@ -98,7 +98,7 @@ abstract class MainThreadKernel implements IResolvedNotebookKernel {
abstract cancelNotebookCellExecution(uri: URI, cellHandles: number[]): Promise<void>;
}
// @extHostNamedCustomer(MainContext.MainThreadNotebookKernels) {{SQL CARBON EDIT}} Disable VS Code notebooks
@extHostNamedCustomer(MainContext.MainThreadNotebookKernels)
export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape {
private readonly _editors = new Map<INotebookEditor, IDisposable>();

View File

@@ -6,9 +6,9 @@
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; // {{SQL CARBON EDIT}} Remove unused
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { INotebookKernelService, INotebookProxyKernel, INotebookProxyKernelChangeEvent, ProxyKernelState, NotebookKernelType } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
import { ExtHostContext, ExtHostNotebookProxyKernelsShape, INotebookProxyKernelDto, MainThreadNotebookProxyKernelsShape } from '../common/extHost.protocol'; // {{SQL CARBON EDIT}} Remove unused
import { ExtHostContext, ExtHostNotebookProxyKernelsShape, INotebookProxyKernelDto, MainContext, MainThreadNotebookProxyKernelsShape } from '../common/extHost.protocol';
import { onUnexpectedError } from 'vs/base/common/errors';
abstract class MainThreadProxyKernel implements INotebookProxyKernel {
@@ -64,7 +64,7 @@ abstract class MainThreadProxyKernel implements INotebookProxyKernel {
abstract resolveKernel(): Promise<string | null>;
}
// @extHostNamedCustomer(MainContext.MainThreadNotebookProxyKernels) {{SQL CARBON EDIT}} Disable VS Code notebooks
@extHostNamedCustomer(MainContext.MainThreadNotebookProxyKernels)
export class MainThreadNotebookProxyKernels implements MainThreadNotebookProxyKernelsShape {
private readonly _disposables = new DisposableStore();

View File

@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import { Disposable } from 'vs/base/common/lifecycle';
import { ExtHostContext, ExtHostNotebookRenderersShape, MainThreadNotebookRenderersShape } from 'vs/workbench/api/common/extHost.protocol';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { ExtHostContext, ExtHostNotebookRenderersShape, MainContext, MainThreadNotebookRenderersShape } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { INotebookRendererMessagingService } from 'vs/workbench/contrib/notebook/common/notebookRendererMessagingService';
// @extHostNamedCustomer(MainContext.MainThreadNotebookRenderers) {{SQL CARBON EDIT}} Disable VS Code notebooks
@extHostNamedCustomer(MainContext.MainThreadNotebookRenderers)
export class MainThreadNotebookRenderers extends Disposable implements MainThreadNotebookRenderersShape {
private readonly proxy: ExtHostNotebookRenderersShape;

View File

@@ -64,7 +64,7 @@ import { ILoggerService, ILogService } from 'vs/platform/log/common/log';
import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
// import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming';
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
@@ -82,19 +82,19 @@ import { ExtHostUriOpeners } from 'vs/workbench/api/common/extHostUriOpener';
import { IExtHostSecretState } from 'vs/workbench/api/common/exHostSecretState';
import { IExtHostEditorTabs } from 'vs/workbench/api/common/extHostEditorTabs';
import { IExtHostTelemetry } from 'vs/workbench/api/common/extHostTelemetry';
// import { ExtHostNotebookKernels } from 'vs/workbench/api/common/extHostNotebookKernels'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { ExtHostNotebookKernels } from 'vs/workbench/api/common/extHostNotebookKernels';
import { TextSearchCompleteMessageType } from 'vs/workbench/services/search/common/searchExtTypes';
// import { ExtHostNotebookRenderers } from 'vs/workbench/api/common/extHostNotebookRenderers'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { ExtHostNotebookRenderers } from 'vs/workbench/api/common/extHostNotebookRenderers';
import { Schemas } from 'vs/base/common/network';
import { matchesScheme } from 'vs/platform/opener/common/opener';
// import { ExtHostNotebookEditors } from 'vs/workbench/api/common/extHostNotebookEditors'; {{SQL CARBON EDIT}} Disable VS Code notebooks
// import { ExtHostNotebookDocuments } from 'vs/workbench/api/common/extHostNotebookDocuments'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { ExtHostNotebookEditors } from 'vs/workbench/api/common/extHostNotebookEditors';
import { ExtHostNotebookDocuments } from 'vs/workbench/api/common/extHostNotebookDocuments';
// import { ExtHostInteractive } from 'vs/workbench/api/common/extHostInteractive'; {{SQL CARBON EDIT}} Remove until we need it
import { combinedDisposable } from 'vs/base/common/lifecycle';
import { checkProposedApiEnabled, ExtensionIdentifierSet, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
import { notebooksNotSupportedError } from 'sql/base/common/locConstants';
import { ExtHostNotebookProxyKernels } from 'vs/workbench/api/common/extHostNotebookProxyKernels';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, CONFIG_WORKBENCH_USEVSCODENOTEBOOKS } from 'sql/workbench/common/constants';
export interface IExtensionRegistries {
mine: ExtensionDescriptionRegistry;
@@ -158,15 +158,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostDocuments = rpcProtocol.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors));
const extHostDocumentContentProviders = rpcProtocol.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(rpcProtocol, extHostDocumentsAndEditors, extHostLogService));
const extHostDocumentSaveParticipant = rpcProtocol.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(extHostLogService, extHostDocuments, rpcProtocol.getProxy(MainContext.MainThreadBulkEdits)));
/* {{SQL CARBON EDIT }} Disable VS Code notebooks
const extHostNotebook = rpcProtocol.set(ExtHostContext.ExtHostNotebook, new ExtHostNotebookController(rpcProtocol, extHostCommands, extHostDocumentsAndEditors, extHostDocuments, extensionStoragePaths));
const extHostNotebookDocuments = rpcProtocol.set(ExtHostContext.ExtHostNotebookDocuments, new ExtHostNotebookDocuments(extHostNotebook));
const extHostNotebookEditors = rpcProtocol.set(ExtHostContext.ExtHostNotebookEditors, new ExtHostNotebookEditors(extHostLogService, rpcProtocol, extHostNotebook));
const extHostNotebookRenderers = rpcProtocol.set(ExtHostContext.ExtHostNotebookRenderers, new ExtHostNotebookRenderers(rpcProtocol, extHostNotebook));
const extHostNotebookKernels = rpcProtocol.set(ExtHostContext.ExtHostNotebookKernels, new ExtHostNotebookKernels(rpcProtocol, initData, <any>extHostNotebook, extHostCommands, extHostLogService));
const extHostNotebookKernels = rpcProtocol.set(ExtHostContext.ExtHostNotebookKernels, new ExtHostNotebookKernels(rpcProtocol, initData, extHostNotebook, extHostCommands, extHostLogService));
const extHostNotebookProxyKernels = rpcProtocol.set(ExtHostContext.ExtHostNotebookProxyKernels, new ExtHostNotebookProxyKernels(rpcProtocol, extHostNotebookKernels, extHostLogService));
*/
const extHostNotebookRenderers = rpcProtocol.set(ExtHostContext.ExtHostNotebookRenderers, new ExtHostNotebookRenderers(rpcProtocol, extHostNotebook));
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(rpcProtocol, extHostDocumentsAndEditors));
const extHostTreeViews = rpcProtocol.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(rpcProtocol.getProxy(MainContext.MainThreadTreeViews), extHostCommands, extHostLogService));
const extHostEditorInsets = rpcProtocol.set(ExtHostContext.ExtHostEditorInsets, new ExtHostEditorInsets(rpcProtocol.getProxy(MainContext.MainThreadEditorInsets), extHostEditors, initData.remote));
@@ -195,13 +192,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
// {{SQL CARBON EDIT}} filter out the services we don't expose
const filteredProxies: Set<ProxyIdentifier<any>> = new Set([
ExtHostContext.ExtHostDebugService,
ExtHostContext.ExtHostNotebook,
ExtHostContext.ExtHostNotebookDocuments,
ExtHostContext.ExtHostNotebookEditors,
ExtHostContext.ExtHostNotebookKernels,
ExtHostContext.ExtHostNotebookProxyKernels,
ExtHostContext.ExtHostNotebookRenderers,
ExtHostContext.ExtHostNotebookProxyKernels,
ExtHostContext.ExtHostInteractive
]);
const expected: ProxyIdentifier<any>[] = values(ExtHostContext).filter(v => !filteredProxies.has(v));
@@ -219,6 +209,15 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
ExtHostApiCommands.register(extHostCommands);
return function (extension: IExtensionDescription, extensionInfo: IExtensionRegistries, configProvider: ExtHostConfigProvider): typeof vscode {
// {{SQL CARBON EDIT}}
const checkVSCodeNotebooksEnabled = (extension: IExtensionDescription) => {
const usePreviewFeatures = configProvider.getConfiguration(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
const useVSCodeNotebooks = configProvider.getConfiguration(CONFIG_WORKBENCH_USEVSCODENOTEBOOKS);
const notebooksEnabled = usePreviewFeatures && useVSCodeNotebooks;
if (!notebooksEnabled) {
throw new Error(`Notebook extension '${extension.identifier.value}' is not supported. VS Code notebook functionality is currently disabled.`);
}
}
// Check document selectors for being overly generic. Technically this isn't a problem but
// in practice many extensions say they support `fooLang` but need fs-access to do so. Those
@@ -775,32 +774,33 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostWebviewViews.registerWebviewViewProvider(extension, viewId, provider, options?.webviewOptions);
},
get activeNotebookEditor(): vscode.NotebookEditor | undefined {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.activeNotebookEditor;
},
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.onDidChangeActiveNotebookEditor(listener, thisArgs, disposables);
},
get visibleNotebookEditors() {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
return undefined;
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.visibleNotebookEditors;
},
get onDidChangeVisibleNotebookEditors() {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
return undefined;
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.onDidChangeVisibleNotebookEditors;
},
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebookEditors.onDidChangeNotebookEditorSelection(listener, thisArgs, disposables);
},
onDidChangeNotebookEditorVisibleRanges(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebookEditors.onDidChangeNotebookEditorVisibleRanges(listener, thisArgs, disposables);
},
showNotebookDocument(uriOrDocument: URI | vscode.NotebookDocument, options?: vscode.NotebookDocumentShowOptions): Thenable<vscode.NotebookEditor> {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
showNotebookDocument(uriOrDocument, options?) {
checkProposedApiEnabled(extension, 'notebookEditor');
checkVSCodeNotebooksEnabled(extension); // {{SQL CARBON EDIT}}
return extHostNotebook.showNotebookDocument(uriOrDocument, options);
},
registerExternalUriOpener(id: string, opener: vscode.ExternalUriOpener, metadata: vscode.ExternalUriOpenerMetadata) {
checkProposedApiEnabled(extension, 'externalUriOpener');
@@ -925,36 +925,39 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostDocumentSaveParticipant.getOnWillSaveTextDocumentEvent(extension)(listener, thisArgs, disposables);
},
get notebookDocuments(): vscode.NotebookDocument[] {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebook.notebookDocuments.map(d => d.apiNotebook);
},
async openNotebookDocument(uriOrType?: URI | string, content?: vscode.NotebookData): Promise<vscode.NotebookDocument> {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
async openNotebookDocument(uriOrType?: URI | string, content?: vscode.NotebookData) {
checkVSCodeNotebooksEnabled(extension); // {{SQL CARBON EDIT}}
let uri: URI;
if (URI.isUri(uriOrType)) {
uri = uriOrType;
await extHostNotebook.openNotebookDocument(uriOrType);
} else if (typeof uriOrType === 'string') {
uri = URI.revive(await extHostNotebook.createNotebookDocument({ viewType: uriOrType, content }));
} else {
throw new Error('Invalid arguments');
}
return extHostNotebook.getNotebookDocument(uri).apiNotebook;
},
onDidSaveNotebookDocument(listener, thisArg, disposables) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebookDocuments.onDidSaveNotebookDocument(listener, thisArg, disposables);
},
onDidChangeNotebookDocument(listener, thisArg, disposables) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebookDocuments.onDidChangeNotebookDocument(listener, thisArg, disposables);
},
get onDidOpenNotebookDocument(): Event<vscode.NotebookDocument> {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebook.onDidOpenNotebookDocument;
},
get onDidCloseNotebookDocument(): Event<vscode.NotebookDocument> {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebook.onDidCloseNotebookDocument;
},
registerNotebookSerializer(viewType: string, serializer: vscode.NotebookSerializer, options?: vscode.NotebookDocumentContentOptions, registration?: vscode.NotebookRegistrationData) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebook.registerNotebookSerializer(extension, viewType, serializer, options, isProposedApiEnabled(extension, 'notebookLiveShare') ? registration : undefined);
},
registerNotebookContentProvider: (viewType: string, provider: vscode.NotebookContentProvider, options?: vscode.NotebookDocumentContentOptions, registration?: vscode.NotebookRegistrationData) => {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookContentProvider');
return extHostNotebook.registerNotebookContentProvider(extension, viewType, provider, options, isProposedApiEnabled(extension, 'notebookLiveShare') ? registration : undefined);
},
onDidChangeConfiguration: (listener: (_: any) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => {
return configProvider.onDidChangeConfiguration(listener, thisArgs, disposables);
@@ -1191,28 +1194,25 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
// namespace: notebook
const notebooks: typeof vscode.notebooks = {
createNotebookController(id: string, notebookType: string, label: string, handler?, rendererScripts?: vscode.NotebookRendererScript[]) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebookKernels.createNotebookController(extension, id, notebookType, label, handler, isProposedApiEnabled(extension, 'notebookMessaging') ? rendererScripts : undefined);
},
registerNotebookCellStatusBarItemProvider: (notebookType: string, provider: vscode.NotebookCellStatusBarItemProvider) => {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider);
},
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookEditorDecorationType');
return extHostNotebookEditors.createNotebookEditorDecorationType(options);
},
createRendererMessaging(rendererId) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
return extHostNotebookRenderers.createRendererMessaging(extension, rendererId);
},
onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookCellExecutionState');
return extHostNotebookKernels.onDidChangeNotebookCellExecutionState(listener, thisArgs, disposables);
},
createNotebookProxyController(id: string, notebookType: string, label: string, handler: () => vscode.NotebookController | string | Thenable<vscode.NotebookController | string>) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(notebooksNotSupportedError);
checkProposedApiEnabled(extension, 'notebookProxyController');
return extHostNotebookProxyKernels.createNotebookProxyController(extension, id, notebookType, label, handler);
}
};

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* {{SQL CARBON EDIT}} Disable notebook breakpoints because the debug service is not enabled
import { RunOnceScheduler } from 'vs/base/common/async';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { ResourceMap } from 'vs/base/common/map';
@@ -197,3 +197,4 @@ class NotebookCellPausing extends Disposable implements IWorkbenchContribution {
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NotebookCellPausing, LifecyclePhase.Restored);
*/

View File

@@ -15,7 +15,7 @@ import { IModelService } from 'vs/editor/common/services/model';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/languages/language';
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import * as nls from 'vs/nls';
import { Extensions, IConfigurationPropertySchema, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; // {{SQL CARBON EDIT}} Remove unused
import { Extensions, IConfigurationPropertySchema, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -105,7 +105,7 @@ import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeat
import { NotebookInfo } from 'vs/editor/common/languageFeatureRegistry';
import { COMMENTEDITOR_DECORATION_KEY } from 'vs/workbench/contrib/comments/browser/commentReply';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import * as locConstants from 'sql/base/common/locConstants';
/*--------------------------------------------------------------------------------------------- */
@@ -728,9 +728,9 @@ for (const editorOption of editorOptionsRegistry) {
}
}
/* {{SQL CARBON EDIT}} Remove VS Notebook configurations
// {{SQL CARBON EDIT}} Add updated description
const editorOptionsCustomizationSchema: IConfigurationPropertySchema = {
description: nls.localize('notebook.editorOptions.experimentalCustomization', 'Settings for code editors used in notebooks. This can be used to customize most editor.* settings.'),
description: locConstants.experimentalCustomizationDescription,
default: {},
allOf: [
{
@@ -748,8 +748,8 @@ const editorOptionsCustomizationSchema: IConfigurationPropertySchema = {
],
tags: ['notebookLayout']
};
*/
// {{SQL CARBON EDIT}} Add updated descriptions
const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
configurationRegistry.registerConfiguration({
id: 'notebook',
@@ -757,161 +757,160 @@ configurationRegistry.registerConfiguration({
title: nls.localize('notebookConfigurationTitle', "Notebook"),
type: 'object',
properties: {
// {{SQL CARBON EDIT}} Remove unused VS Code Notebook configurations
// [DisplayOrderKey]: {
// description: nls.localize('notebook.displayOrder.description', "Priority list for output mime types"),
// type: ['array'],
// items: {
// type: 'string'
// },
// default: []
// },
// [NotebookSetting.cellToolbarLocation]: {
// description: nls.localize('notebook.cellToolbarLocation.description', "Where the cell toolbar should be shown, or whether it should be hidden."),
// type: 'object',
// additionalProperties: {
// markdownDescription: nls.localize('notebook.cellToolbarLocation.viewType', "Configure the cell toolbar position for for specific file types"),
// type: 'string',
// enum: ['left', 'right', 'hidden']
// },
// default: {
// 'default': 'right'
// },
// tags: ['notebookLayout']
// },
// [ShowCellStatusBar]: {
// description: nls.localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown."),
// 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: 'visible',
// tags: ['notebookLayout']
// },
// [NotebookTextDiffEditorPreview]: {
// description: nls.localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook."),
// type: 'boolean',
// default: true,
// tags: ['notebookLayout']
// },
// [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]: {
// description: nls.localize('notebook.undoRedoPerCell.description', "Whether to use separate undo/redo stack for each cell."),
// type: 'boolean',
// default: true,
// tags: ['notebookLayout']
// },
// [CompactView]: {
// description: nls.localize('notebook.compactView.description', "Control whether the notebook editor should be rendered in a compact form. "),
// type: 'boolean',
// default: true,
// tags: ['notebookLayout']
// },
// [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]: {
// description: nls.localize('notebook.insertToolbarPosition.description', "Control where the insert cell actions should appear."),
// type: 'string',
// enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'],
// enumDescriptions: [
// nls.localize('insertToolbarLocation.betweenCells', "A toolbar that appears on hover between cells."),
// nls.localize('insertToolbarLocation.notebookToolbar', "The toolbar at the top of the notebook editor."),
// nls.localize('insertToolbarLocation.both', "Both toolbars."),
// nls.localize('insertToolbarLocation.hidden', "The insert actions don't appear anywhere."),
// ],
// default: 'both',
// tags: ['notebookLayout']
// },
// [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]: {
// description: nls.localize('notebook.consolidatedOutputButton.description', "Control whether outputs action should be rendered in the output toolbar."),
// type: 'boolean',
// default: true,
// tags: ['notebookLayout']
// },
// [ShowFoldingControls]: {
// description: nls.localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown."),
// type: 'string',
// enum: ['always', 'mouseover'],
// enumDescriptions: [
// nls.localize('showFoldingControls.always', "The folding controls are always visible."),
// nls.localize('showFoldingControls.mouseover', "The folding controls are visible only on mouseover."),
// ],
// default: 'mouseover',
// tags: ['notebookLayout']
// },
// [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]: {
// 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]: {
// description: nls.localize('notebook.globalToolbarShowLabel', "Control whether the actions on the notebook toolbar should render label or not."),
// type: 'boolean',
// enum: ['always', 'never', 'dynamic'],
// default: true,
// tags: ['notebookLayout']
// },
// [TextOutputLineLimit]: {
// description: nls.localize('notebook.textOutputLineLimit', "Control how many lines of text in a text output is rendered."),
// type: 'number',
// default: 30,
// tags: ['notebookLayout']
// },
// [NotebookSetting.markupFontSize]: {
// markdownDescription: nls.localize('notebook.markup.fontSize', "Controls the font size of rendered markup in notebooks. When set to `0`, 120% of `#editor.fontSize#` is used."),
// type: 'number',
// default: 0,
// tags: ['notebookLayout']
// },
// [NotebookSetting.cellEditorOptionsCustomizations]: editorOptionsCustomizationSchema
// [NotebookSetting.interactiveWindowCollapseCodeCells]: {
// markdownDescription: nls.localize('notebook.interactiveWindow.collapseCodeCells', "Controls whether code cells in the interactive window are collapsed by default."),
// type: 'string',
// enum: ['always', 'never', 'fromEditor'],
// default: 'fromEditor'
// },
// [NotebookSetting.outputLineHeight]: {
// markdownDescription: nls.localize('notebook.outputLineHeight', "Line height of the output text for notebook cells.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values."),
// type: 'number',
// default: 22,
// tags: ['notebookLayout']
// },
// [NotebookSetting.outputFontSize]: {
// markdownDescription: nls.localize('notebook.outputFontSize', "Font size for the output text for notebook cells. When set to 0 `#editor.fontSize#` is used."),
// type: 'number',
// default: 0,
// tags: ['notebookLayout']
// },
// [NotebookSetting.outputFontFamily]: {
// markdownDescription: nls.localize('notebook.outputFontFamily', "The font family for the output text for notebook cells. When set to empty, the `#editor.fontFamily#` is used."),
// type: 'string',
// tags: ['notebookLayout']
// },
[NotebookSetting.displayOrder]: {
description: locConstants.displayOrderDescription,
type: 'array',
items: {
type: 'string'
},
default: []
},
[NotebookSetting.cellToolbarLocation]: {
description: locConstants.cellToolbarLocationDescription,
type: 'object',
additionalProperties: {
markdownDescription: nls.localize('notebook.cellToolbarLocation.viewType', "Configure the cell toolbar position for for specific file types"),
type: 'string',
enum: ['left', 'right', 'hidden']
},
default: {
'default': 'right'
},
tags: ['notebookLayout']
},
[NotebookSetting.showCellStatusBar]: {
description: locConstants.showCellStatusbarDescription,
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: 'visible',
tags: ['notebookLayout']
},
[NotebookSetting.textDiffEditorPreview]: {
description: locConstants.diffEnablePreviewDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.cellToolbarVisibility]: {
markdownDescription: locConstants.cellToolbarVisibilityDescription,
type: 'string',
enum: ['hover', 'click'],
default: 'click',
tags: ['notebookLayout']
},
[NotebookSetting.undoRedoPerCell]: {
description: locConstants.undoRedoPerCellDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.compactView]: {
description: locConstants.compactViewDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.focusIndicator]: {
description: locConstants.focusIndicatorDescription,
type: 'string',
enum: ['border', 'gutter'],
default: 'gutter',
tags: ['notebookLayout']
},
[NotebookSetting.insertToolbarLocation]: {
description: locConstants.insertToolbarPositionDescription,
type: 'string',
enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'],
enumDescriptions: [
nls.localize('insertToolbarLocation.betweenCells', "A toolbar that appears on hover between cells."),
nls.localize('insertToolbarLocation.notebookToolbar', "The toolbar at the top of the notebook editor."),
nls.localize('insertToolbarLocation.both', "Both toolbars."),
nls.localize('insertToolbarLocation.hidden', "The insert actions don't appear anywhere."),
],
default: 'both',
tags: ['notebookLayout']
},
[NotebookSetting.globalToolbar]: {
description: locConstants.globalToolbarDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.consolidatedOutputButton]: {
description: locConstants.consolidatedOutputButtonDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.showFoldingControls]: {
description: locConstants.showFoldingControlsDescription,
type: 'string',
enum: ['always', 'mouseover'],
enumDescriptions: [
nls.localize('showFoldingControls.always', "The folding controls are always visible."),
nls.localize('showFoldingControls.mouseover', "The folding controls are visible only on mouseover."),
],
default: 'mouseover',
tags: ['notebookLayout']
},
[NotebookSetting.dragAndDropEnabled]: {
description: locConstants.dragAndDropDescription,
type: 'boolean',
default: true,
tags: ['notebookLayout']
},
[NotebookSetting.consolidatedRunButton]: {
description: locConstants.consolidatedRunButtonDescription,
type: 'boolean',
default: false,
tags: ['notebookLayout']
},
[NotebookSetting.globalToolbarShowLabel]: {
description: locConstants.globalToolbarShowLabelDescription,
type: 'string',
enum: ['always', 'never', 'dynamic'],
default: 'always',
tags: ['notebookLayout']
},
[NotebookSetting.textOutputLineLimit]: {
description: locConstants.textOutputLineLimitDescription,
type: 'number',
default: 30,
tags: ['notebookLayout']
},
[NotebookSetting.markupFontSize]: {
markdownDescription: locConstants.markupFontSizeDescription,
type: 'number',
default: 0,
tags: ['notebookLayout']
},
[NotebookSetting.cellEditorOptionsCustomizations]: editorOptionsCustomizationSchema,
[NotebookSetting.interactiveWindowCollapseCodeCells]: {
markdownDescription: locConstants.interactiveWindowCollapseCodeCellsDescription,
type: 'string',
enum: ['always', 'never', 'fromEditor'],
default: 'fromEditor'
},
[NotebookSetting.outputLineHeight]: {
markdownDescription: locConstants.outputLineHeightDescription,
type: 'number',
default: 22,
tags: ['notebookLayout']
},
[NotebookSetting.outputFontSize]: {
markdownDescription: locConstants.outputFontSizeDescription,
type: 'number',
default: 0,
tags: ['notebookLayout']
},
[NotebookSetting.outputFontFamily]: {
markdownDescription: locConstants.outputFontFamilyDescription,
type: 'string',
tags: ['notebookLayout']
},
}
});

View File

@@ -3,6 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, CONFIG_WORKBENCH_USEVSCODENOTEBOOKS } from 'sql/workbench/common/constants';
import { PixelRatio } from 'vs/base/browser/browser';
import { Emitter, Event } from 'vs/base/common/event';
import * as glob from 'vs/base/common/glob';
@@ -16,7 +17,6 @@ import { URI } from 'vs/base/common/uri';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
// import { localize } from 'vs/nls'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
@@ -24,12 +24,12 @@ import { IFileService } from 'vs/platform/files/common/files';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { Memento } from 'vs/workbench/common/memento';
import { notebookRendererExtensionPoint } from 'vs/workbench/contrib/notebook/browser/extensionPoint'; // {{SQL CARBON EDIT}} Remove INotebookEditorContribution, notebooksExtensionPoint
import { INotebookEditorContribution, notebookRendererExtensionPoint, notebooksExtensionPoint } from 'vs/workbench/contrib/notebook/browser/extensionPoint';
import { INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
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, CellUri, NotebookSetting, INotebookContributionData, INotebookExclusiveDocumentFilter, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IOutputDto, MimeTypeDisplayOrder, NotebookData, NotebookRendererMatch, NOTEBOOK_DISPLAY_ORDER, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, TransientOptions, NotebookExtensionDescription } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellUri, NotebookSetting, INotebookContributionData, INotebookExclusiveDocumentFilter, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, IOutputDto, MimeTypeDisplayOrder, NotebookData, NotebookEditorPriority, NotebookRendererMatch, NOTEBOOK_DISPLAY_ORDER, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, TransientOptions, NotebookExtensionDescription } 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';
@@ -38,7 +38,7 @@ import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/con
import { ComplexNotebookProviderInfo, INotebookContentProvider, INotebookSerializer, INotebookService, SimpleNotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookService';
import { DiffEditorInputFactoryFunction, EditorInputFactoryFunction, IEditorResolverService, IEditorType, RegisteredEditorInfo, RegisteredEditorPriority, UntitledEditorInputFactoryFunction } from 'vs/workbench/services/editor/common/editorResolverService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
// import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry'; {{SQL CARBON EDIT}} Disable VS Code notebooks
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
export class NotebookProviderInfoStore extends Disposable {
@@ -79,7 +79,12 @@ export class NotebookProviderInfoStore extends Disposable {
}
}));
// notebooksExtensionPoint.setHandler(extensions => this._setupHandler(extensions)); {{SQL CARBON EDIT}} Disable VS Code notebooks
// {{SQL CARBON EDIT}} Disable file associations here if we're not using VS Code notebooks by default
const usePreviewFeatures = this._configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
const useVSCodeNotebooks = this._configurationService.getValue(CONFIG_WORKBENCH_USEVSCODENOTEBOOKS);
if (usePreviewFeatures && useVSCodeNotebooks) {
notebooksExtensionPoint.setHandler(extensions => this._setupHandler(extensions));
}
}
override dispose(): void {
@@ -87,7 +92,6 @@ export class NotebookProviderInfoStore extends Disposable {
super.dispose();
}
/* // {{SQL CARBON EDIT}} Disable VS Code notebooks
private _setupHandler(extensions: readonly IExtensionPointUser<INotebookEditorContribution[]>[]) {
this._handled = true;
const builtins: NotebookProviderInfo[] = [...this._contributedEditors.values()].filter(info => !info.extension);
@@ -153,7 +157,6 @@ export class NotebookProviderInfoStore extends Disposable {
return RegisteredEditorPriority.option;
}
*/
private _registerContributionPoint(notebookProviderInfo: NotebookProviderInfo): IDisposable {
@@ -221,6 +224,7 @@ export class NotebookProviderInfoStore extends Disposable {
return disposables;
}
private _clear(): void {
this._contributedEditors.clear();
this._contributedEditorDisposables.clear();
@@ -421,35 +425,40 @@ export class NotebookService extends Disposable implements INotebookService {
) {
super();
notebookRendererExtensionPoint.setHandler((renderers) => {
this._notebookRenderersInfoStore.clear();
// {{SQL CARBON EDIT}} Disable renderer associations here if we're not using VS Code notebooks by default
const usePreviewFeatures = this._configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
const useVSCodeNotebooks = this._configurationService.getValue(CONFIG_WORKBENCH_USEVSCODENOTEBOOKS);
if (usePreviewFeatures && useVSCodeNotebooks) {
notebookRendererExtensionPoint.setHandler((renderers) => {
this._notebookRenderersInfoStore.clear();
for (const extension of renderers) {
for (const notebookContribution of extension.value) {
if (!notebookContribution.entrypoint) { // avoid crashing
extension.collector.error(`Notebook renderer does not specify entry point`);
continue;
for (const extension of renderers) {
for (const notebookContribution of extension.value) {
if (!notebookContribution.entrypoint) { // avoid crashing
extension.collector.error(`Notebook renderer does not specify entry point`);
continue;
}
const id = notebookContribution.id;
if (!id) {
extension.collector.error(`Notebook renderer does not specify id-property`);
continue;
}
this._notebookRenderersInfoStore.add(new NotebookOutputRendererInfo({
id,
extension: extension.description,
entrypoint: notebookContribution.entrypoint,
displayName: notebookContribution.displayName,
mimeTypes: notebookContribution.mimeTypes || [],
dependencies: notebookContribution.dependencies,
optionalDependencies: notebookContribution.optionalDependencies,
requiresMessaging: notebookContribution.requiresMessaging,
}));
}
const id = notebookContribution.id;
if (!id) {
extension.collector.error(`Notebook renderer does not specify id-property`);
continue;
}
this._notebookRenderersInfoStore.add(new NotebookOutputRendererInfo({
id,
extension: extension.description,
entrypoint: notebookContribution.entrypoint,
displayName: notebookContribution.displayName,
mimeTypes: notebookContribution.mimeTypes || [],
dependencies: notebookContribution.dependencies,
optionalDependencies: notebookContribution.optionalDependencies,
requiresMessaging: notebookContribution.requiresMessaging,
}));
}
}
});
});
}
const updateOrder = () => {
this._displayOrder = new MimeTypeDisplayOrder(
@@ -518,7 +527,7 @@ export class NotebookService extends Disposable implements INotebookService {
}
clearEditorCache(): void {
// this.notebookProviderInfoStore.clearEditorCache(); // {{SQL CARBON EDIT}} - method disabled
this.notebookProviderInfoStore.clearEditorCache();
}
private _postDocumentOpenActivation(viewType: string) {

View File

@@ -313,13 +313,6 @@ class ExtensionHostManager extends Disposable implements IExtensionHostManager {
// {{SQL CARBON EDIT}} filter out services we don't expose
const filtered: ProxyIdentifier<any>[] = [
MainContext.MainThreadDebugService,
MainContext.MainThreadNotebook,
MainContext.MainThreadNotebookDocuments,
MainContext.MainThreadNotebookEditors,
MainContext.MainThreadNotebookKernels,
MainContext.MainThreadNotebookProxyKernels,
MainContext.MainThreadNotebookRenderers,
MainContext.MainThreadNotebookProxyKernels,
MainContext.MainThreadInteractive
];
const expected: ProxyIdentifier<any>[] = Object.keys(MainContext).map((key) => (<any>MainContext)[key]).filter(v => !filtered.some(x => x === v));