mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
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:
@@ -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 });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user