Port most notebook model code over to be behind a service (#3068)

- Defines a new NotebookService in Azure Data Studio which will be used to interact with notebooks. Since notebooks can require per-file instantiation the provider is just used to create & track managers for a given URI.
- Inject this into notebook.component.ts and pass required parameters that'll be used to properly initialize a manger into the method. Actual initialization not done yet.
- Port over & recompile notebook model code
- Define most required APIs in sqlops.proposed.d.ts. In the future, these will be used by extensions to contribute their own providers.
This commit is contained in:
Kevin Cunnane
2018-10-31 22:01:40 -07:00
committed by GitHub
parent ac0ffab99c
commit fc3bf45a7f
29 changed files with 2973 additions and 53 deletions

View File

@@ -11,9 +11,14 @@ import { Action } from 'vs/base/common/actions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { TPromise } from 'vs/base/common/winjs.base';
import * as nls from 'vs/nls';
import { Schemas } from 'vs/base/common/network';
import { NotebookInput, NotebookInputModel } from 'sql/parts/notebook/notebookInput';
import { NotebookEditor } from 'sql/parts/notebook/notebookEditor';
import URI from 'vs/base/common/uri';
let counter = 0;
/**
* todo: Will remove this code.
@@ -34,7 +39,8 @@ export class OpenNotebookAction extends Action {
public run(): TPromise<void> {
return new TPromise<void>((resolve, reject) => {
let model = new NotebookInputModel('modelViewId', undefined, undefined);
let untitledUri = URI.from({ scheme: Schemas.untitled, path: `Untitled-${counter++}`});
let model = new NotebookInputModel(untitledUri, undefined, undefined);
let input = new NotebookInput('modelViewId', model);
this._editorService.openEditor(input, { pinned: true });
});