mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Notebook model ready sooner (#10420)
This commit is contained in:
@@ -42,6 +42,7 @@ export class NotebookEditorModel extends EditorModel {
|
|||||||
private _notebookTextFileModel: NotebookTextFileModel;
|
private _notebookTextFileModel: NotebookTextFileModel;
|
||||||
private readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
|
private readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
|
||||||
private _lastEditFullReplacement: boolean;
|
private _lastEditFullReplacement: boolean;
|
||||||
|
private _isFirstKernelChange: boolean = true;
|
||||||
constructor(public readonly notebookUri: URI,
|
constructor(public readonly notebookUri: URI,
|
||||||
private textEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | ResourceEditorModel,
|
private textEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | ResourceEditorModel,
|
||||||
@INotebookService private notebookService: INotebookService,
|
@INotebookService private notebookService: INotebookService,
|
||||||
@@ -110,6 +111,10 @@ export class NotebookEditorModel extends EditorModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public updateModel(contentChange?: NotebookContentChange, type?: NotebookChangeType): void {
|
public updateModel(contentChange?: NotebookContentChange, type?: NotebookChangeType): void {
|
||||||
|
if (type === NotebookChangeType.KernelChanged && this._isFirstKernelChange) {
|
||||||
|
this._isFirstKernelChange = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._lastEditFullReplacement = false;
|
this._lastEditFullReplacement = false;
|
||||||
if (contentChange && contentChange.changeType === NotebookChangeType.Saved) {
|
if (contentChange && contentChange.changeType === NotebookChangeType.Saved) {
|
||||||
// We send the saved events out, so ignore. Otherwise we double-count this as a change
|
// We send the saved events out, so ignore. Otherwise we double-count this as a change
|
||||||
|
|||||||
@@ -238,10 +238,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
private async doLoad(): Promise<void> {
|
private async doLoad(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await this.createModelAndLoadContents();
|
await this.createModelAndLoadContents();
|
||||||
await this.setNotebookManager();
|
|
||||||
await this.loadModel();
|
|
||||||
this._modelReadyDeferred.resolve(this._model);
|
this._modelReadyDeferred.resolve(this._model);
|
||||||
this.notebookService.addNotebookEditor(this);
|
this.notebookService.addNotebookEditor(this);
|
||||||
|
await this.setNotebookManager();
|
||||||
|
await this.loadModel();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
// Offer to create a file from the error if we have a file not found and the name is valid
|
// Offer to create a file from the error if we have a file not found and the name is valid
|
||||||
|
|||||||
Reference in New Issue
Block a user