Begin defining Extension-based Notebook Provider (#3172)

Implements provider contribution in the MainThreadNotebook, with matching function calls in the ExtHostNotebook class. This will allow us to proxy through notebook providers (specifically, creation of a notebook manager with required content, server managers) from an extension up through to the main process.

Implemented in this PR:
- Callthroughs for content and server manager APIs
- Very basic unit tests covering provider & manager registration

Not implemented:
- Fuller unit tests on the specific callthrough methods for content & server manager.
- Contribution point needed to test this (so we can actually pass through the extension's existing Notebook implementation)
This commit is contained in:
Kevin Cunnane
2018-11-08 13:06:40 -08:00
committed by GitHub
parent 71c14a0837
commit 9765269d27
14 changed files with 597 additions and 49 deletions

View File

@@ -21,7 +21,7 @@ import { ITreeComponentItem } from 'sql/workbench/common/views';
import { ITaskHandlerDescription } from 'sql/platform/tasks/common/tasks';
import {
IItemConfig, ModelComponentTypes, IComponentShape, IModelViewDialogDetails, IModelViewTabDetails, IModelViewButtonDetails,
IModelViewWizardDetails, IModelViewWizardPageDetails
IModelViewWizardDetails, IModelViewWizardPageDetails, INotebookManagerDetails
} from 'sql/workbench/api/common/sqlExtHostTypes';
export abstract class ExtHostAccountManagementShape {
@@ -711,15 +711,21 @@ export interface ExtHostNotebookShape {
/**
* Looks up a notebook manager for a given notebook URI
* @param {number} providerHandle
* @param {vscode.Uri} notebookUri
* @returns {Thenable<string>} handle of the manager to be used when sending
*/
getNotebookManager(notebookUri: vscode.Uri): Thenable<number>;
handleNotebookClosed(notebookUri: vscode.Uri): void;
$getNotebookManager(providerHandle: number, notebookUri: UriComponents): Thenable<INotebookManagerDetails>;
$handleNotebookClosed(notebookUri: UriComponents): void;
$doStartServer(managerHandle: number): Thenable<void>;
$doStopServer(managerHandle: number): Thenable<void>;
$getNotebookContents(managerHandle: number, notebookUri: UriComponents): Thenable<sqlops.nb.INotebook>;
$save(managerHandle: number, notebookUri: UriComponents, notebook: sqlops.nb.INotebook): Thenable<sqlops.nb.INotebook>;
}
export interface MainThreadNotebookShape extends IDisposable {
$registerNotebookProvider(providerId: string, handle: number): void;
$unregisterNotebookProvider(handle: number): void;
}
}