#3920: Notebooks file save/save all/cache - for existing files (#4286)

* #3920: Notebooks file save

* Missed in merge

* #4290: Untitled save and native dirty implementation

* Misc changes

* Content Manager, notebooks extension and commented failed unit tests

* Removing modelLoaded event
This commit is contained in:
Raj
2019-03-07 18:07:20 -08:00
committed by GitHub
parent 2a903e9f03
commit 036ffe595a
15 changed files with 486 additions and 400 deletions

View File

@@ -21,10 +21,9 @@ import {
SqlMainContext, MainThreadNotebookDocumentsAndEditorsShape, SqlExtHostContext, ExtHostNotebookDocumentsAndEditorsShape,
INotebookDocumentsAndEditorsDelta, INotebookEditorAddData, INotebookShowOptions, INotebookModelAddedData, INotebookModelChangedData
} from 'sql/workbench/api/node/sqlExtHost.protocol';
import { NotebookInputModel, NotebookInput } from 'sql/parts/notebook/notebookInput';
import { NotebookInput, NotebookEditorModel } from 'sql/parts/notebook/notebookInput';
import { INotebookService, INotebookEditor, DEFAULT_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
import { TPromise } from 'vs/base/common/winjs.base';
import { getProvidersForFileName, getStandardKernelsForProvider } from 'sql/parts/notebook/notebookUtils';
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
import { disposed } from 'vs/base/common/errors';
import { ICellModel, NotebookContentChange, INotebookModel } from 'sql/parts/notebook/models/modelInterfaces';
@@ -361,26 +360,10 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
pinned: !options.preview
};
let trusted = uri.scheme === Schemas.untitled;
let model = new NotebookInputModel(uri, undefined, trusted, undefined, undefined, undefined, options.connectionId);
let providerId = options.providerId;
let providers: string[] = undefined;
// Ensure there is always a sensible provider ID for this file type
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;
model.defaultKernel = options && options.defaultKernel;
model.providers.forEach(provider => {
let standardKernels = getStandardKernelsForProvider(provider, this._notebookService);
model.standardKernels = standardKernels;
});
let input = this._instantiationService.createInstance(NotebookInput, undefined, model);
let input = this._instantiationService.createInstance(NotebookInput, uri.fsPath, uri);
input.isTrusted = trusted;
input.defaultKernel = options.defaultKernel;
input.connectionProfileId = options.connectionId;
let editor = await this._editorService.openEditor(input, editorOptions, viewColumnToEditorGroup(this._editorGroupService, options.position));
if (!editor) {