Enable VS Code extension APIs for getting opened notebook documents (#18043)

This commit is contained in:
Cory Rivera
2022-01-11 12:57:55 -08:00
committed by GitHub
parent 7940814e8d
commit df2934a80c
3 changed files with 81 additions and 15 deletions

View File

@@ -94,6 +94,8 @@ import { matchesScheme } from 'vs/platform/opener/common/opener';
import { ExtHostNotebook } from 'sql/workbench/api/common/extHostNotebook';
import { functionalityNotSupportedError } from 'sql/base/common/locConstants';
import { ExtHostNotebookDocumentsAndEditors } from 'sql/workbench/api/common/extHostNotebookDocumentsAndEditors';
import { VSCodeNotebookDocument } from 'sql/workbench/api/common/vscodeNotebookDocument';
import { VSCodeNotebookEditor } from 'sql/workbench/api/common/vscodeNotebookEditor';
export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
@@ -716,10 +718,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
return extHostWebviewViews.registerWebviewViewProvider(extension, viewId, provider, options?.webviewOptions);
},
get activeNotebookEditor(): vscode.NotebookEditor | undefined {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(functionalityNotSupportedError);
// checkProposedApiEnabled(extension);
// return extHostNotebook.activeNotebookEditor;
// {{SQL CARBON EDIT}} Use our own notebooks
return new VSCodeNotebookEditor(extHostNotebookDocumentsAndEditors.getActiveEditor());
},
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
@@ -884,9 +884,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor, ex
return extHostDocumentSaveParticipant.getOnWillSaveTextDocumentEvent(extension)(listener, thisArgs, disposables);
},
get notebookDocuments(): vscode.NotebookDocument[] {
// {{SQL CARBON EDIT}} Disable VS Code notebooks
throw new Error(functionalityNotSupportedError);
// return extHostNotebook.notebookDocuments.map(d => d.apiNotebook);
// {{SQL CARBON EDIT}} Use our own notebooks
return extHostNotebookDocumentsAndEditors.getAllDocuments().map(doc => new VSCodeNotebookDocument(doc.document));
},
async openNotebookDocument(uriOrType?: URI | string, content?: vscode.NotebookData) {
// {{SQL CARBON EDIT}} Disable VS Code notebooks