mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
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:
@@ -98,6 +98,7 @@ import { ExtHostNotebookDocumentsAndEditors } from 'sql/workbench/api/common/ext
|
||||
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/notebooks/vscodeNotebookDocument';
|
||||
import { VSCodeNotebookEditor } from 'sql/workbench/api/common/notebooks/vscodeNotebookEditor';
|
||||
import { convertToADSNotebookContents } from 'sql/workbench/api/common/notebooks/notebookUtils';
|
||||
import { IdGenerator } from 'vs/base/common/idGenerator';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
|
||||
@@ -211,6 +212,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
|
||||
// Register API-ish commands
|
||||
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 {
|
||||
|
||||
// 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;
|
||||
},
|
||||
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookEditors.onDidChangeNotebookEditorSelection(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeEditorSelection(listener, thisArgs, disposables);
|
||||
},
|
||||
onDidChangeNotebookEditorVisibleRanges(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookEditors.onDidChangeNotebookEditorVisibleRanges(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeEditorRanges(listener, thisArgs, disposables);
|
||||
},
|
||||
showNotebookDocument(uriOrDocument: URI | vscode.NotebookDocument, options?: vscode.NotebookDocumentShowOptions): Thenable<vscode.NotebookEditor> {
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
@@ -1164,52 +1164,46 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
|
||||
// return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider);
|
||||
},
|
||||
get onDidSaveNotebookDocument(): Event<vscode.NotebookDocument> {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookDocuments.onDidSaveNotebookDocument;
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidSaveVSCodeNotebookDocument;
|
||||
},
|
||||
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookEditors.createNotebookEditorDecorationType(options);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
// Returning this stub class for now, since we don't support renderer contributions yet
|
||||
return {
|
||||
key: DecorationTypeKeys.nextId(),
|
||||
dispose: () => undefined
|
||||
};
|
||||
},
|
||||
createRendererMessaging(rendererId) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookRenderers.createRendererMessaging(extension, rendererId);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
// Returning this stub class for now, since we don't support renderer contributions yet
|
||||
let receivedMessage = new Emitter<{ editor: vscode.NotebookEditor, message: any }>();
|
||||
let rendererMessaging: vscode.NotebookRendererMessaging = {
|
||||
onDidReceiveMessage: (listener, thisArg, disposables) => receivedMessage.event(listener, thisArg, disposables),
|
||||
postMessage: () => Promise.resolve(false)
|
||||
};
|
||||
return rendererMessaging;
|
||||
},
|
||||
onDidChangeNotebookDocumentMetadata(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebookDocuments.onDidChangeNotebookDocumentMetadata(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeDocumentMetadata(listener, thisArgs, disposables);
|
||||
},
|
||||
onDidChangeNotebookCells(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeNotebookCells(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeNotebookCells(listener, thisArgs, disposables);
|
||||
},
|
||||
onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeNotebookCellExecutionState(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeExecutionState(listener, thisArgs, disposables);
|
||||
},
|
||||
onDidChangeCellOutputs(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeCellOutputs(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeCellOutputs(listener, thisArgs, disposables);
|
||||
},
|
||||
onDidChangeCellMetadata(listener, thisArgs?, disposables?) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
throw new Error(functionalityNotSupportedError);
|
||||
// checkProposedApiEnabled(extension);
|
||||
// return extHostNotebook.onDidChangeCellMetadata(listener, thisArgs, disposables);
|
||||
// {{SQL CARBON EDIT}} Use our own notebooks
|
||||
return extHostNotebookDocumentsAndEditors.onDidChangeVSCodeCellMetadata(listener, thisArgs, disposables);
|
||||
},
|
||||
createConcatTextDocument(notebook, selector) {
|
||||
// {{SQL CARBON EDIT}} Disable VS Code notebooks
|
||||
|
||||
Reference in New Issue
Block a user