Support notebook file types contribution (#3196)

* Support notebook file types contribution
- Extensions can define a provider and what file types it should be used for
- Verified that this works for Jupyter Content & Server Managers.
- Starts Jupyter server as expected

Not in this PR:
- Support for session manager end to end
- Tests
This commit is contained in:
Kevin Cunnane
2018-11-12 17:32:53 -08:00
committed by GitHub
parent 0a486a280d
commit 0b571737b7
6 changed files with 198 additions and 19 deletions

View File

@@ -13,10 +13,12 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { Schemas } from 'vs/base/common/network';
import URI from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { NotebookInput, NotebookInputModel } from 'sql/parts/notebook/notebookInput';
import { NotebookEditor } from 'sql/parts/notebook/notebookEditor';
let counter = 0;
/**
@@ -31,7 +33,8 @@ export class OpenNotebookAction extends Action {
constructor(
id: string,
label: string,
@IEditorService private _editorService: IEditorService
@IEditorService private _editorService: IEditorService,
@IInstantiationService private _instantiationService: IInstantiationService
) {
super(id, label);
}
@@ -40,7 +43,7 @@ export class OpenNotebookAction extends Action {
return new TPromise<void>((resolve, reject) => {
let untitledUri = URI.from({ scheme: Schemas.untitled, path: `Untitled-${counter++}`});
let model = new NotebookInputModel(untitledUri, undefined, false, undefined);
let input = new NotebookInput('modelViewId', model,);
let input = this._instantiationService.createInstance(NotebookInput, 'modelViewId', model);
this._editorService.openEditor(input, { pinned: true });
});
}