Integrate first SQL Notebooks Bits into Master (#3679)

* First crack tsql notebook (no output rendered yet)

* getting messages back

* intellisense working first cell, no connection errors

* sql notebook cell output functioning

* Latest SQL noteobook changes

* Undo change to launch.json

* Plumbing providers through

* Kernels shown from multiple providers, can switch between them. No mementos yet

* Ensure we have a feature flag for SQL notebooks, ensure existing functionality still works

* Fix tslint duplicate imports issue

* Addressing PR comments

* second round of PR feedback to cleanup notebook service manager code

* merge latest from master
This commit is contained in:
Chris LaFreniere
2019-01-09 14:58:57 -08:00
committed by GitHub
parent 3d3694bb8d
commit 42afcf9322
23 changed files with 667 additions and 123 deletions

View File

@@ -23,9 +23,9 @@ import {
INotebookDocumentsAndEditorsDelta, INotebookEditorAddData, INotebookShowOptions, INotebookModelAddedData, INotebookModelChangedData
} from 'sql/workbench/api/node/sqlExtHost.protocol';
import { NotebookInputModel, NotebookInput } from 'sql/parts/notebook/notebookInput';
import { INotebookService, INotebookEditor } from 'sql/services/notebook/notebookService';
import { INotebookService, INotebookEditor, DEFAULT_NOTEBOOK_PROVIDER } from 'sql/services/notebook/notebookService';
import { TPromise } from 'vs/base/common/winjs.base';
import { getProviderForFileName } from 'sql/parts/notebook/notebookUtils';
import { getProvidersForFileName } from 'sql/parts/notebook/notebookUtils';
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
import { disposed } from 'vs/base/common/errors';
import { ICellModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces';
@@ -57,6 +57,10 @@ class MainThreadNotebookEditor extends Disposable {
return this.editor.notebookParams.providerId;
}
public get providers(): string[] {
return this.editor.notebookParams.providers;
}
public get cells(): ICellModel[] {
return this.editor.cells;
}
@@ -316,11 +320,20 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
let trusted = uri.scheme === Schemas.untitled;
let model = new NotebookInputModel(uri, undefined, trusted, undefined);
let providerId = options.providerId;
if (!providerId) {
let providers: string[] = undefined;
if (!providerId)
{
// Ensure there is always a sensible provider ID for this file type
providerId = getProviderForFileName(uri.fsPath, this._notebookService);
providers = getProvidersForFileName(uri.fsPath, this._notebookService);
// Try to use a non-builtin provider first
if (providers) {
providerId = providers.find(p => p !== DEFAULT_NOTEBOOK_PROVIDER);
if (!providerId) {
providerId = model.providerId;
}
}
}
model.providers = providers;
model.providerId = providerId;
let input = this._instantiationService.createInstance(NotebookInput, undefined, model);
@@ -452,6 +465,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
uri: editor.uri,
isDirty: editor.isDirty,
providerId: editor.providerId,
providers: editor.providers,
cells: this.convertCellModelToNotebookCell(editor.cells)
};
return addData;
@@ -463,6 +477,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
cells: this.convertCellModelToNotebookCell(editor.cells),
isDirty: e.isDirty,
providerId: editor.providerId,
providers: editor.providers,
uri: editor.uri
};
return changeData;

View File

@@ -796,6 +796,7 @@ export interface INotebookDocumentsAndEditorsDelta {
export interface INotebookModelAddedData {
uri: UriComponents;
providerId: string;
providers: string[];
isDirty: boolean;
cells: sqlops.nb.NotebookCell[];
}
@@ -803,6 +804,7 @@ export interface INotebookModelAddedData {
export interface INotebookModelChangedData {
uri: UriComponents;
providerId: string;
providers: string[];
isDirty: boolean;
cells: sqlops.nb.NotebookCell[];
}