mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
* #4418: Notebook icon doesn't load for untitled * Indentation * Indentation
This commit is contained in:
@@ -132,6 +132,7 @@ export class NotebookInput extends EditorInput {
|
|||||||
private _parentContainer: HTMLElement;
|
private _parentContainer: HTMLElement;
|
||||||
private readonly _layoutChanged: Emitter<void> = this._register(new Emitter<void>());
|
private readonly _layoutChanged: Emitter<void> = this._register(new Emitter<void>());
|
||||||
private _model: NotebookEditorModel;
|
private _model: NotebookEditorModel;
|
||||||
|
private _untitledEditorModel: UntitledEditorModel;
|
||||||
private _contentManager: IContentManager;
|
private _contentManager: IContentManager;
|
||||||
private _providersLoaded: Promise<void>;
|
private _providersLoaded: Promise<void>;
|
||||||
|
|
||||||
@@ -246,13 +247,21 @@ export class NotebookInput extends EditorInput {
|
|||||||
return this.resource;
|
return this.resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get untitledEditorModel() : UntitledEditorModel {
|
||||||
|
return this._untitledEditorModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set untitledEditorModel(value : UntitledEditorModel) {
|
||||||
|
this._untitledEditorModel = value;
|
||||||
|
}
|
||||||
|
|
||||||
async resolve(): Promise<NotebookEditorModel> {
|
async resolve(): Promise<NotebookEditorModel> {
|
||||||
if (this._model && this._model.isModelCreated()) {
|
if (this._model && this._model.isModelCreated()) {
|
||||||
return Promise.resolve(this._model);
|
return Promise.resolve(this._model);
|
||||||
} else {
|
} else {
|
||||||
let textOrUntitledEditorModel: UntitledEditorModel | IEditorModel;
|
let textOrUntitledEditorModel: UntitledEditorModel | IEditorModel;
|
||||||
if (this.resource.scheme === Schemas.untitled) {
|
if (this.resource.scheme === Schemas.untitled) {
|
||||||
textOrUntitledEditorModel = await this._textInput.resolve();
|
textOrUntitledEditorModel = this._untitledEditorModel ? this._untitledEditorModel : await this._textInput.resolve();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);
|
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);
|
||||||
|
|||||||
@@ -371,12 +371,16 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
|||||||
let isUntitled: boolean = uri.scheme === Schemas.untitled;
|
let isUntitled: boolean = uri.scheme === Schemas.untitled;
|
||||||
|
|
||||||
const fileInput = isUntitled ? this._untitledEditorService.createOrGet(uri, notebookModeId) :
|
const fileInput = isUntitled ? this._untitledEditorService.createOrGet(uri, notebookModeId) :
|
||||||
this._editorService.createInput({resource: uri, language: notebookModeId});
|
this._editorService.createInput({ resource: uri, language: notebookModeId });
|
||||||
let input = this._instantiationService.createInstance(NotebookInput, path.basename(uri.fsPath), uri, fileInput);
|
let input = this._instantiationService.createInstance(NotebookInput, path.basename(uri.fsPath), uri, fileInput);
|
||||||
input.isTrusted = isUntitled;
|
input.isTrusted = isUntitled;
|
||||||
input.defaultKernel = options.defaultKernel;
|
input.defaultKernel = options.defaultKernel;
|
||||||
input.connectionProfile = new ConnectionProfile(this._capabilitiesService, options.connectionProfile);
|
input.connectionProfile = new ConnectionProfile(this._capabilitiesService, options.connectionProfile);
|
||||||
|
if (isUntitled) {
|
||||||
|
let untitledModel = await input.textInput.resolve();
|
||||||
|
untitledModel.load();
|
||||||
|
input.untitledEditorModel = untitledModel;
|
||||||
|
}
|
||||||
let editor = await this._editorService.openEditor(input, editorOptions, viewColumnToEditorGroup(this._editorGroupService, options.position));
|
let editor = await this._editorService.openEditor(input, editorOptions, viewColumnToEditorGroup(this._editorGroupService, options.position));
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user