mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
* #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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user