Add placeholders for missing VSCode notebook events that are used by the Jupyter extension. (#18138)

* Also reduced the number of timeouts for waiting on notebook provider descriptors, and fixed an issue with undefined cancellation tokens in vscode notebook conversion code.
This commit is contained in:
Cory Rivera
2022-01-25 14:03:33 -08:00
committed by GitHub
parent f0dd31c457
commit 9685393975
9 changed files with 182 additions and 164 deletions

View File

@@ -49,3 +49,4 @@ export const workspaceTrustDescription = localize('workspace.trust.description',
export function workspaceTrustEmptyWindowDescription(settingName: string): string { return localize('workspace.trust.emptyWindow.description', "Controls whether or not the empty window is trusted by default within Azure Data Studio. When used with `#{0}#`, you can enable the full functionality of Azure Data Studio without prompting in an empty window.", settingName); } export function workspaceTrustEmptyWindowDescription(settingName: string): string { return localize('workspace.trust.emptyWindow.description', "Controls whether or not the empty window is trusted by default within Azure Data Studio. When used with `#{0}#`, you can enable the full functionality of Azure Data Studio without prompting in an empty window.", settingName); }
export const functionalityNotSupportedError = localize('vscodeFunctionalityNotSupportedError', "This VS Code functionality is not supported in Azure Data Studio."); export const functionalityNotSupportedError = localize('vscodeFunctionalityNotSupportedError', "This VS Code functionality is not supported in Azure Data Studio.");
export const invalidArgumentsError = localize('vscodeInvalidArgumentsError', "Invalid arguments"); export const invalidArgumentsError = localize('vscodeInvalidArgumentsError', "Invalid arguments");
export const cellToolbarCompatibilityMessage = localize('notebook.cellToolbarLocation.compatibilityDescription', "Where the cell toolbar should be shown, or whether it should be hidden. Note: This setting is only enabled for extension compatibility purposes, and so does not affect anything.");

View File

@@ -54,10 +54,27 @@ export class ExtHostNotebookDocumentsAndEditors implements ExtHostNotebookDocume
private readonly _onDidChangeActiveVSCodeEditor = new Emitter<vscode.NotebookEditor>(); private readonly _onDidChangeActiveVSCodeEditor = new Emitter<vscode.NotebookEditor>();
private readonly _onDidOpenVSCodeNotebook = new Emitter<vscode.NotebookDocument>(); private readonly _onDidOpenVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
private readonly _onDidCloseVSCodeNotebook = new Emitter<vscode.NotebookDocument>(); private readonly _onDidCloseVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
private readonly _onDidSaveVSCodeNotebook = new Emitter<vscode.NotebookDocument>();
private readonly _onDidChangeVSCodeCellMetadata = new Emitter<vscode.NotebookCellMetadataChangeEvent>();
private readonly _onDidChangeVSCodeDocumentMetadata = new Emitter<vscode.NotebookDocumentMetadataChangeEvent>();
private readonly _onDidChangeVSCodeCellOutputs = new Emitter<vscode.NotebookCellOutputsChangeEvent>();
private readonly _onDidChangeVSCodeNotebookCells = new Emitter<vscode.NotebookCellsChangeEvent>();
private readonly _onDidChangeVSCodeExecutionState = new Emitter<vscode.NotebookCellExecutionStateChangeEvent>();
private readonly _onDidChangeVSCodeEditorSelection = new Emitter<vscode.NotebookEditorSelectionChangeEvent>();
private readonly _onDidChangeVSCodeEditorRanges = new Emitter<vscode.NotebookEditorVisibleRangesChangeEvent>();
readonly onDidChangeVisibleVSCodeEditors: Event<vscode.NotebookEditor[]> = this._onDidChangeVisibleVSCodeEditors.event; readonly onDidChangeVisibleVSCodeEditors: Event<vscode.NotebookEditor[]> = this._onDidChangeVisibleVSCodeEditors.event;
readonly onDidChangeActiveVSCodeEditor: Event<vscode.NotebookEditor> = this._onDidChangeActiveVSCodeEditor.event; readonly onDidChangeActiveVSCodeEditor: Event<vscode.NotebookEditor> = this._onDidChangeActiveVSCodeEditor.event;
readonly onDidOpenVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidOpenVSCodeNotebook.event; readonly onDidOpenVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidOpenVSCodeNotebook.event;
readonly onDidCloseVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseVSCodeNotebook.event; readonly onDidCloseVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidCloseVSCodeNotebook.event;
readonly onDidSaveVSCodeNotebookDocument: Event<vscode.NotebookDocument> = this._onDidSaveVSCodeNotebook.event;
readonly onDidChangeVSCodeCellMetadata: Event<vscode.NotebookCellMetadataChangeEvent> = this._onDidChangeVSCodeCellMetadata.event;
readonly onDidChangeVSCodeDocumentMetadata: Event<vscode.NotebookDocumentMetadataChangeEvent> = this._onDidChangeVSCodeDocumentMetadata.event;
readonly onDidChangeVSCodeCellOutputs: Event<vscode.NotebookCellOutputsChangeEvent> = this._onDidChangeVSCodeCellOutputs.event;
readonly onDidChangeVSCodeNotebookCells: Event<vscode.NotebookCellsChangeEvent> = this._onDidChangeVSCodeNotebookCells.event;
readonly onDidChangeVSCodeExecutionState: Event<vscode.NotebookCellExecutionStateChangeEvent> = this._onDidChangeVSCodeExecutionState.event;
readonly onDidChangeVSCodeEditorSelection: Event<vscode.NotebookEditorSelectionChangeEvent> = this._onDidChangeVSCodeEditorSelection.event;
readonly onDidChangeVSCodeEditorRanges: Event<vscode.NotebookEditorVisibleRangesChangeEvent> = this._onDidChangeVSCodeEditorRanges.event;
constructor( constructor(
private readonly _mainContext: IMainContext, private readonly _mainContext: IMainContext,

View File

@@ -14,6 +14,7 @@ import { URI } from 'vs/base/common/uri';
import { NotebookCellExecutionTaskState } from 'vs/workbench/api/common/extHostNotebookKernels'; import { NotebookCellExecutionTaskState } from 'vs/workbench/api/common/extHostNotebookKernels';
import { asArray } from 'vs/base/common/arrays'; import { asArray } from 'vs/base/common/arrays';
import { convertToADSCellOutput } from 'sql/workbench/api/common/notebooks/notebookUtils'; import { convertToADSCellOutput } from 'sql/workbench/api/common/notebooks/notebookUtils';
import { CancellationToken } from 'vs/base/common/cancellation';
type SelectionChangedEvent = { selected: boolean, notebook: vscode.NotebookDocument; }; type SelectionChangedEvent = { selected: boolean, notebook: vscode.NotebookDocument; };
type MessageReceivedEvent = { editor: vscode.NotebookEditor, message: any; }; type MessageReceivedEvent = { editor: vscode.NotebookEditor, message: any; };
@@ -173,7 +174,7 @@ class ADSNotebookCellExecution implements vscode.NotebookCellExecution {
} }
public get token(): vscode.CancellationToken { public get token(): vscode.CancellationToken {
return undefined; return CancellationToken.None;
} }
public get executionOrder(): number { public get executionOrder(): number {

View File

@@ -40,6 +40,6 @@ export class VSCodeNotebookEditor implements vscode.NotebookEditor {
} }
public setDecorations(decorationType: vscode.NotebookEditorDecorationType, range: vscode.NotebookRange): void { public setDecorations(decorationType: vscode.NotebookEditorDecorationType, range: vscode.NotebookRange): void {
throw new Error(functionalityNotSupportedError); // No-op
} }
} }

View File

@@ -6,7 +6,7 @@
import type * as vscode from 'vscode'; import type * as vscode from 'vscode';
import type * as azdata from 'azdata'; import type * as azdata from 'azdata';
import { VSBuffer } from 'vs/base/common/buffer'; import { VSBuffer } from 'vs/base/common/buffer';
import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { CancellationToken } from 'vs/base/common/cancellation';
import { convertToADSNotebookContents, convertToVSCodeNotebookData } from 'sql/workbench/api/common/notebooks/notebookUtils'; import { convertToADSNotebookContents, convertToVSCodeNotebookData } from 'sql/workbench/api/common/notebooks/notebookUtils';
export class VSCodeContentManager implements azdata.nb.ContentManager { export class VSCodeContentManager implements azdata.nb.ContentManager {
@@ -15,13 +15,13 @@ export class VSCodeContentManager implements azdata.nb.ContentManager {
public async deserializeNotebook(contents: string): Promise<azdata.nb.INotebookContents> { public async deserializeNotebook(contents: string): Promise<azdata.nb.INotebookContents> {
let buffer = VSBuffer.fromString(contents); let buffer = VSBuffer.fromString(contents);
let notebookData = await this._serializer.deserializeNotebook(buffer.buffer, new CancellationTokenSource().token); let notebookData = await this._serializer.deserializeNotebook(buffer.buffer, CancellationToken.None);
return convertToADSNotebookContents(notebookData); return convertToADSNotebookContents(notebookData);
} }
public async serializeNotebook(notebook: azdata.nb.INotebookContents): Promise<string> { public async serializeNotebook(notebook: azdata.nb.INotebookContents): Promise<string> {
let notebookData = convertToVSCodeNotebookData(notebook); let notebookData = convertToVSCodeNotebookData(notebook);
let bytes = await this._serializer.serializeNotebook(notebookData, new CancellationTokenSource().token); let bytes = await this._serializer.serializeNotebook(notebookData, CancellationToken.None);
let buffer = VSBuffer.wrap(bytes); let buffer = VSBuffer.wrap(bytes);
return buffer.toString(); return buffer.toString();
} }

View File

@@ -179,7 +179,7 @@ export class NotebookService extends Disposable implements INotebookService {
private _onNotebookEditorRename = new Emitter<INotebookEditor>(); private _onNotebookEditorRename = new Emitter<INotebookEditor>();
private _editors = new Map<string, INotebookEditor>(); private _editors = new Map<string, INotebookEditor>();
private _fileToProviderDescriptions = new Map<string, ProviderDescriptionRegistration[]>(); private _fileToProviderDescriptions = new Map<string, ProviderDescriptionRegistration[]>();
private _providerToStandardKernels = new Map<string, StandardKernelsDescriptor>(); private _providerToStandardKernels = new Map<string, StandardKernelsDescriptor>(); // Note: providerId key here should be in upper case
private _registrationComplete = new Deferred<void>(); private _registrationComplete = new Deferred<void>();
private _isRegistrationComplete = false; private _isRegistrationComplete = false;
private _trustedCacheQueue: URI[] = []; private _trustedCacheQueue: URI[] = [];
@@ -693,6 +693,7 @@ export class NotebookService extends Disposable implements INotebookService {
providerDescriptor.instanceReady, providerDescriptor.instanceReady,
new Promise<ISerializationProvider | undefined>((resolve, reject) => setTimeout(() => { new Promise<ISerializationProvider | undefined>((resolve, reject) => setTimeout(() => {
if (!providerDescriptor.instance) { if (!providerDescriptor.instance) {
this._serializationProviders.delete(providerDescriptor.providerId); // Remove waiting descriptor so we don't timeout again
onUnexpectedError(localize('serializationProviderTimeout', 'Waiting for Serialization Provider availability timed out for notebook provider \'{0}\'', providerDescriptor.providerId)); onUnexpectedError(localize('serializationProviderTimeout', 'Waiting for Serialization Provider availability timed out for notebook provider \'{0}\'', providerDescriptor.providerId));
} }
resolve(undefined); resolve(undefined);
@@ -708,6 +709,7 @@ export class NotebookService extends Disposable implements INotebookService {
providerDescriptor.instanceReady, providerDescriptor.instanceReady,
new Promise<IExecuteProvider | undefined>((resolve, reject) => setTimeout(() => { new Promise<IExecuteProvider | undefined>((resolve, reject) => setTimeout(() => {
if (!providerDescriptor.instance) { if (!providerDescriptor.instance) {
this._executeProviders.delete(providerDescriptor.providerId); // Remove waiting descriptor so we don't timeout again
onUnexpectedError(localize('executeProviderTimeout', 'Waiting for Execute Provider availability timed out for notebook provider \'{0}\'', providerDescriptor.providerId)); onUnexpectedError(localize('executeProviderTimeout', 'Waiting for Execute Provider availability timed out for notebook provider \'{0}\'', providerDescriptor.providerId));
} }
resolve(undefined); resolve(undefined);
@@ -723,6 +725,7 @@ export class NotebookService extends Disposable implements INotebookService {
kernelsDescriptor.instanceReady, kernelsDescriptor.instanceReady,
new Promise<nb.IStandardKernel[] | undefined>((resolve, reject) => setTimeout(() => { new Promise<nb.IStandardKernel[] | undefined>((resolve, reject) => setTimeout(() => {
if (!kernelsDescriptor.instance) { if (!kernelsDescriptor.instance) {
this._providerToStandardKernels.delete(kernelsDescriptor.providerId.toUpperCase()); // Remove waiting descriptor so we don't timeout again
onUnexpectedError(localize('standardKernelsTimeout', 'Waiting for Standard Kernels availability timed out for notebook provider \'{0}\'', kernelsDescriptor.providerId)); onUnexpectedError(localize('standardKernelsTimeout', 'Waiting for Standard Kernels availability timed out for notebook provider \'{0}\'', kernelsDescriptor.providerId));
} }
resolve(undefined); resolve(undefined);

View File

@@ -459,7 +459,6 @@ suite('Notebook Serializer', () => {
assert.throws(() => vscodeEditor.visibleRanges); assert.throws(() => vscodeEditor.visibleRanges);
assert.throws(() => vscodeEditor.viewColumn); assert.throws(() => vscodeEditor.viewColumn);
assert.throws(() => vscodeEditor.revealRange(undefined)); assert.throws(() => vscodeEditor.revealRange(undefined));
assert.throws(() => vscodeEditor.setDecorations(undefined, undefined));
await assert.rejects(() => vscodeEditor.edit(() => undefined)); await assert.rejects(() => vscodeEditor.edit(() => undefined));
}); });
}); });

View File

@@ -98,6 +98,7 @@ import { ExtHostNotebookDocumentsAndEditors } from 'sql/workbench/api/common/ext
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument'; import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument';
import { VSCodeNotebookEditor } from 'sql/workbench/api/common/notebooks/vscodeNotebookEditor'; import { VSCodeNotebookEditor } from 'sql/workbench/api/common/notebooks/vscodeNotebookEditor';
import { convertToADSNotebookContents } from 'sql/workbench/api/common/notebooks/notebookUtils'; import { convertToADSNotebookContents } from 'sql/workbench/api/common/notebooks/notebookUtils';
import { IdGenerator } from 'vs/base/common/idGenerator';
export interface IExtensionApiFactory { export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode; (extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
@@ -211,6 +212,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
// Register API-ish commands // Register API-ish commands
ExtHostApiCommands.register(extHostCommands); ExtHostApiCommands.register(extHostCommands);
// {{SQL CARBON EDIT}} Used for creating stubbed out DecorationTypes for compatibility purposes
const DecorationTypeKeys = new IdGenerator('VSCodeNotebookEditorDecorationType');
return function (extension: IExtensionDescription, extensionRegistry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode { return function (extension: IExtensionDescription, extensionRegistry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode {
// Check document selectors for being overly generic. Technically this isn't a problem but // Check document selectors for being overly generic. Technically this isn't a problem but
@@ -736,16 +740,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
return extHostNotebookDocumentsAndEditors.onDidChangeVisibleVSCodeEditors; return extHostNotebookDocumentsAndEditors.onDidChangeVisibleVSCodeEditors;
}, },
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) { onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeEditorSelection(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebookEditors.onDidChangeNotebookEditorSelection(listener, thisArgs, disposables);
}, },
onDidChangeNotebookEditorVisibleRanges(listener, thisArgs?, disposables?) { onDidChangeNotebookEditorVisibleRanges(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeEditorRanges(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebookEditors.onDidChangeNotebookEditorVisibleRanges(listener, thisArgs, disposables);
}, },
showNotebookDocument(uriOrDocument: URI | vscode.NotebookDocument, options?: vscode.NotebookDocumentShowOptions): Thenable<vscode.NotebookEditor> { showNotebookDocument(uriOrDocument: URI | vscode.NotebookDocument, options?: vscode.NotebookDocumentShowOptions): Thenable<vscode.NotebookEditor> {
// {{SQL CARBON EDIT}} Use our own notebooks // {{SQL CARBON EDIT}} Use our own notebooks
@@ -1164,52 +1164,46 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
// return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider); // return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider);
}, },
get onDidSaveNotebookDocument(): Event<vscode.NotebookDocument> { get onDidSaveNotebookDocument(): Event<vscode.NotebookDocument> {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidSaveVSCodeNotebookDocument;
// checkProposedApiEnabled(extension);
// return extHostNotebookDocuments.onDidSaveNotebookDocument;
}, },
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType { createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); // Returning this stub class for now, since we don't support renderer contributions yet
// checkProposedApiEnabled(extension); return {
// return extHostNotebookEditors.createNotebookEditorDecorationType(options); key: DecorationTypeKeys.nextId(),
dispose: () => undefined
};
}, },
createRendererMessaging(rendererId) { createRendererMessaging(rendererId) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); // Returning this stub class for now, since we don't support renderer contributions yet
// checkProposedApiEnabled(extension); let receivedMessage = new Emitter<{ editor: vscode.NotebookEditor, message: any }>();
// return extHostNotebookRenderers.createRendererMessaging(extension, rendererId); let rendererMessaging: vscode.NotebookRendererMessaging = {
onDidReceiveMessage: (listener, thisArg, disposables) => receivedMessage.event(listener, thisArg, disposables),
postMessage: () => Promise.resolve(false)
};
return rendererMessaging;
}, },
onDidChangeNotebookDocumentMetadata(listener, thisArgs?, disposables?) { onDidChangeNotebookDocumentMetadata(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeDocumentMetadata(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebookDocuments.onDidChangeNotebookDocumentMetadata(listener, thisArgs, disposables);
}, },
onDidChangeNotebookCells(listener, thisArgs?, disposables?) { onDidChangeNotebookCells(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeNotebookCells(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebook.onDidChangeNotebookCells(listener, thisArgs, disposables);
}, },
onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) { onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeExecutionState(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebook.onDidChangeNotebookCellExecutionState(listener, thisArgs, disposables);
}, },
onDidChangeCellOutputs(listener, thisArgs?, disposables?) { onDidChangeCellOutputs(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeCellOutputs(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebook.onDidChangeCellOutputs(listener, thisArgs, disposables);
}, },
onDidChangeCellMetadata(listener, thisArgs?, disposables?) { onDidChangeCellMetadata(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Use our own notebooks
throw new Error(functionalityNotSupportedError); return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeCellMetadata(listener, thisArgs, disposables);
// checkProposedApiEnabled(extension);
// return extHostNotebook.onDidChangeCellMetadata(listener, thisArgs, disposables);
}, },
createConcatTextDocument(notebook, selector) { createConcatTextDocument(notebook, selector) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks // {{SQL CARBON EDIT}} Disable VS Code notebooks

View File

@@ -15,8 +15,8 @@ import { ITextModel, ITextBufferFactory, DefaultEndOfLine, ITextBuffer } from 'v
import { IModelService } from 'vs/editor/common/services/modelService'; import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService'; import { IModeService } from 'vs/editor/common/services/modeService';
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService'; import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
// import * as nls from 'vs/nls'; {{SQL CARBON EDIT}} Remove unused import * as nls from 'vs/nls';
import { IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; // {{SQL CARBON EDIT}} Remove unused import { Extensions, IConfigurationPropertySchema, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; // {{SQL CARBON EDIT}} Remove unused
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -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 { isCompositeNotebookEditorInput, NotebookEditorInput, NotebookEditorInputOptions } from 'vs/workbench/contrib/notebook/common/notebookEditorInput';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { NotebookService } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl'; import { NotebookService } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl';
import { CellKind, CellUri, UndoRedoPerCell, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookWorkingCopyTypeIdentifier, IOutputItemDto } from 'vs/workbench/contrib/notebook/common/notebookCommon'; // {{SQL CARBON EDIT}} Remove unused import { CellKind, CellUri, UndoRedoPerCell, IResolvedNotebookEditorModel, NotebookDocumentBackupData, NotebookWorkingCopyTypeIdentifier, IOutputItemDto, CellToolbarLocation } from 'vs/workbench/contrib/notebook/common/notebookCommon'; // {{SQL CARBON EDIT}} Remove unused
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService'; import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
@@ -93,6 +93,7 @@ import { NotebookExecutionService } from 'vs/workbench/contrib/notebook/browser/
import { INotebookExecutionService } from 'vs/workbench/contrib/notebook/common/notebookExecutionService'; import { INotebookExecutionService } from 'vs/workbench/contrib/notebook/common/notebookExecutionService';
import { INotebookKeymapService } from 'vs/workbench/contrib/notebook/common/notebookKeymapService'; import { INotebookKeymapService } from 'vs/workbench/contrib/notebook/common/notebookKeymapService';
import { NotebookKeymapService } from 'vs/workbench/contrib/notebook/browser/notebookKeymapServiceImpl'; import { NotebookKeymapService } from 'vs/workbench/contrib/notebook/browser/notebookKeymapServiceImpl';
import { cellToolbarCompatibilityMessage } from 'sql/base/common/locConstants';
/*--------------------------------------------------------------------------------------------- */ /*--------------------------------------------------------------------------------------------- */
@@ -650,6 +651,7 @@ const editorOptionsCustomizationSchema: IConfigurationPropertySchema = {
], ],
tags: ['notebookLayout'] tags: ['notebookLayout']
}; };
*/
const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration); const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
configurationRegistry.registerConfiguration({ configurationRegistry.registerConfiguration({
@@ -658,16 +660,17 @@ configurationRegistry.registerConfiguration({
title: nls.localize('notebookConfigurationTitle', "Notebook"), title: nls.localize('notebookConfigurationTitle', "Notebook"),
type: 'object', type: 'object',
properties: { properties: {
[DisplayOrderKey]: { // {{SQL CARBON EDIT}} Remove unused VS Code Notebook configurations
description: nls.localize('notebook.displayOrder.description', "Priority list for output mime types"), // [DisplayOrderKey]: {
type: ['array'], // description: nls.localize('notebook.displayOrder.description', "Priority list for output mime types"),
items: { // type: ['array'],
type: 'string' // items: {
}, // type: 'string'
default: [] // },
}, // default: []
// },
[CellToolbarLocation]: { [CellToolbarLocation]: {
description: nls.localize('notebook.cellToolbarLocation.description', "Where the cell toolbar should be shown, or whether it should be hidden."), description: cellToolbarCompatibilityMessage, // {{SQL CARBON EDIT}}
type: 'object', type: 'object',
additionalProperties: { additionalProperties: {
markdownDescription: nls.localize('notebook.cellToolbarLocation.viewType', "Configure the cell toolbar position for for specific file types"), markdownDescription: nls.localize('notebook.cellToolbarLocation.viewType', "Configure the cell toolbar position for for specific file types"),
@@ -679,110 +682,110 @@ configurationRegistry.registerConfiguration({
}, },
tags: ['notebookLayout'] tags: ['notebookLayout']
}, },
[ShowCellStatusBar]: { // {{SQL CARBON EDIT}} Remove unused VS Code Notebook configurations
description: nls.localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown."), // [ShowCellStatusBar]: {
type: 'string', // description: nls.localize('notebook.showCellStatusbar.description', "Whether the cell status bar should be shown."),
enum: ['hidden', 'visible', 'visibleAfterExecute'], // type: 'string',
enumDescriptions: [ // enum: ['hidden', 'visible', 'visibleAfterExecute'],
nls.localize('notebook.showCellStatusbar.hidden.description', "The cell Status bar is always hidden."), // enumDescriptions: [
nls.localize('notebook.showCellStatusbar.visible.description', "The cell Status bar is always visible."), // nls.localize('notebook.showCellStatusbar.hidden.description', "The cell Status bar is always hidden."),
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.")], // nls.localize('notebook.showCellStatusbar.visible.description', "The cell Status bar is always visible."),
default: '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.")],
tags: ['notebookLayout'] // default: 'visible',
}, // tags: ['notebookLayout']
[NotebookTextDiffEditorPreview]: { // },
description: nls.localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook."), // [NotebookTextDiffEditorPreview]: {
type: 'boolean', // description: nls.localize('notebook.diff.enablePreview.description', "Whether to use the enhanced text diff editor for notebook."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // default: true,
}, // tags: ['notebookLayout']
[CellToolbarVisibility]: { // },
markdownDescription: nls.localize('notebook.cellToolbarVisibility.description', "Whether the cell toolbar should appear on hover or click."), // [CellToolbarVisibility]: {
type: 'string', // markdownDescription: nls.localize('notebook.cellToolbarVisibility.description', "Whether the cell toolbar should appear on hover or click."),
enum: ['hover', 'click'], // type: 'string',
default: 'click', // enum: ['hover', 'click'],
tags: ['notebookLayout'] // default: 'click',
}, // tags: ['notebookLayout']
[UndoRedoPerCell]: { // },
description: nls.localize('notebook.undoRedoPerCell.description', "Whether to use separate undo/redo stack for each cell."), // [UndoRedoPerCell]: {
type: 'boolean', // description: nls.localize('notebook.undoRedoPerCell.description', "Whether to use separate undo/redo stack for each cell."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // default: true,
}, // tags: ['notebookLayout']
[CompactView]: { // },
description: nls.localize('notebook.compactView.description', "Control whether the notebook editor should be rendered in a compact form. "), // [CompactView]: {
type: 'boolean', // description: nls.localize('notebook.compactView.description', "Control whether the notebook editor should be rendered in a compact form. "),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // 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"), // [FocusIndicator]: {
type: 'string', // description: nls.localize('notebook.focusIndicator.description', "Controls where the focus indicator is rendered, either along the cell borders or on the left gutter"),
enum: ['border', 'gutter'], // type: 'string',
default: 'gutter', // enum: ['border', 'gutter'],
tags: ['notebookLayout'] // default: 'gutter',
}, // tags: ['notebookLayout']
[InsertToolbarLocation]: { // },
description: nls.localize('notebook.insertToolbarPosition.description', "Control where the insert cell actions should appear."), // [InsertToolbarLocation]: {
type: 'string', // description: nls.localize('notebook.insertToolbarPosition.description', "Control where the insert cell actions should appear."),
enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'], // type: 'string',
enumDescriptions: [ // enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'],
nls.localize('insertToolbarLocation.betweenCells', "A toolbar that appears on hover between cells."), // enumDescriptions: [
nls.localize('insertToolbarLocation.notebookToolbar', "The toolbar at the top of the notebook editor."), // nls.localize('insertToolbarLocation.betweenCells', "A toolbar that appears on hover between cells."),
nls.localize('insertToolbarLocation.both', "Both toolbars."), // nls.localize('insertToolbarLocation.notebookToolbar', "The toolbar at the top of the notebook editor."),
nls.localize('insertToolbarLocation.hidden', "The insert actions don't appear anywhere."), // nls.localize('insertToolbarLocation.both', "Both toolbars."),
], // nls.localize('insertToolbarLocation.hidden', "The insert actions don't appear anywhere."),
default: 'both', // ],
tags: ['notebookLayout'] // default: 'both',
}, // tags: ['notebookLayout']
[GlobalToolbar]: { // },
description: nls.localize('notebook.globalToolbar.description', "Control whether to render a global toolbar inside the notebook editor."), // [GlobalToolbar]: {
type: 'boolean', // description: nls.localize('notebook.globalToolbar.description', "Control whether to render a global toolbar inside the notebook editor."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // default: true,
}, // tags: ['notebookLayout']
[ConsolidatedOutputButton]: { // },
description: nls.localize('notebook.consolidatedOutputButton.description', "Control whether outputs action should be rendered in the output toolbar."), // [ConsolidatedOutputButton]: {
type: 'boolean', // description: nls.localize('notebook.consolidatedOutputButton.description', "Control whether outputs action should be rendered in the output toolbar."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // default: true,
}, // tags: ['notebookLayout']
[ShowFoldingControls]: { // },
description: nls.localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown."), // [ShowFoldingControls]: {
type: 'string', // description: nls.localize('notebook.showFoldingControls.description', "Controls when the Markdown header folding arrow is shown."),
enum: ['always', 'mouseover'], // type: 'string',
enumDescriptions: [ // enum: ['always', 'mouseover'],
nls.localize('showFoldingControls.always', "The folding controls are always visible."), // enumDescriptions: [
nls.localize('showFoldingControls.mouseover', "The folding controls are visible only on mouseover."), // 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'] // default: 'mouseover',
}, // tags: ['notebookLayout']
[DragAndDropEnabled]: { // },
description: nls.localize('notebook.dragAndDrop.description', "Control whether the notebook editor should allow moving cells through drag and drop."), // [DragAndDropEnabled]: {
type: 'boolean', // description: nls.localize('notebook.dragAndDrop.description', "Control whether the notebook editor should allow moving cells through drag and drop."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // 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."), // [ConsolidatedRunButton]: {
type: 'boolean', // description: nls.localize('notebook.consolidatedRunButton.description', "Control whether extra actions are shown in a dropdown next to the run button."),
default: false, // type: 'boolean',
tags: ['notebookLayout'] // default: false,
}, // tags: ['notebookLayout']
[GlobalToolbarShowLabel]: { // },
description: nls.localize('notebook.globalToolbarShowLabel', "Control whether the actions on the notebook toolbar should render label or not."), // [GlobalToolbarShowLabel]: {
type: 'boolean', // description: nls.localize('notebook.globalToolbarShowLabel', "Control whether the actions on the notebook toolbar should render label or not."),
default: true, // type: 'boolean',
tags: ['notebookLayout'] // default: true,
}, // tags: ['notebookLayout']
[TextOutputLineLimit]: { // },
description: nls.localize('notebook.textOutputLineLimit', "Control how many lines of text in a text output is rendered."), // [TextOutputLineLimit]: {
type: 'number', // description: nls.localize('notebook.textOutputLineLimit', "Control how many lines of text in a text output is rendered."),
default: 30, // type: 'number',
tags: ['notebookLayout'] // default: 30,
}, // tags: ['notebookLayout']
[NotebookCellEditorOptionsCustomizations]: editorOptionsCustomizationSchema // },
// [NotebookCellEditorOptionsCustomizations]: editorOptionsCustomizationSchema
} }
}); });
*/