#4418: Notebook file icon doesn't show for new notebook (#4676)

* #4418: Notebook icon doesn't load for untitled

* Indentation

* Indentation
This commit is contained in:
Raj
2019-03-25 16:05:04 -07:00
committed by GitHub
parent 1bac929ab3
commit 83c8baf8e3
2 changed files with 16 additions and 3 deletions

View File

@@ -132,6 +132,7 @@ export class NotebookInput extends EditorInput {
private _parentContainer: HTMLElement;
private readonly _layoutChanged: Emitter<void> = this._register(new Emitter<void>());
private _model: NotebookEditorModel;
private _untitledEditorModel: UntitledEditorModel;
private _contentManager: IContentManager;
private _providersLoaded: Promise<void>;
@@ -246,13 +247,21 @@ export class NotebookInput extends EditorInput {
return this.resource;
}
public get untitledEditorModel() : UntitledEditorModel {
return this._untitledEditorModel;
}
public set untitledEditorModel(value : UntitledEditorModel) {
this._untitledEditorModel = value;
}
async resolve(): Promise<NotebookEditorModel> {
if (this._model && this._model.isModelCreated()) {
return Promise.resolve(this._model);
} else {
let textOrUntitledEditorModel: UntitledEditorModel | IEditorModel;
if (this.resource.scheme === Schemas.untitled) {
textOrUntitledEditorModel = await this._textInput.resolve();
textOrUntitledEditorModel = this._untitledEditorModel ? this._untitledEditorModel : await this._textInput.resolve();
}
else {
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);