diff --git a/news/2 Fixes/14016.md b/news/2 Fixes/14016.md new file mode 100644 index 000000000000..022396ed2b00 --- /dev/null +++ b/news/2 Fixes/14016.md @@ -0,0 +1 @@ +Have Custom Editors load on editor show unless autostart is disabled. \ No newline at end of file diff --git a/src/client/datascience/interactive-common/interactiveBase.ts b/src/client/datascience/interactive-common/interactiveBase.ts index 5e0c1d11e16c..01b55deed731 100644 --- a/src/client/datascience/interactive-common/interactiveBase.ts +++ b/src/client/datascience/interactive-common/interactiveBase.ts @@ -216,14 +216,11 @@ export abstract class InteractiveBase extends WebviewPanelHost { - // Verify a server that matches us hasn't started already - this.createNotebookIfProviderConnectionExists().ignoreErrors(); - // Show our web panel. - return super.show(preserveFocus); + // If we have already auto started our server then we can go ahead and try to create a notebook on construction + setTimeout(() => { + this.createNotebookIfProviderConnectionExists().ignoreErrors(); + }, 0); } // tslint:disable-next-line: no-any no-empty cyclomatic-complexity max-func-body-length @@ -610,7 +607,7 @@ export abstract class InteractiveBase extends WebviewPanelHost { + public async show(preserveFocus: boolean = true): Promise { await this.loadPromise; return super.show(preserveFocus); } diff --git a/src/client/datascience/notebookStorage/nativeEditorProvider.ts b/src/client/datascience/notebookStorage/nativeEditorProvider.ts index 23fcaa04da53..f2015fd9eff0 100644 --- a/src/client/datascience/notebookStorage/nativeEditorProvider.ts +++ b/src/client/datascience/notebookStorage/nativeEditorProvider.ts @@ -276,7 +276,7 @@ export class NativeEditorProvider implements INotebookEditorProvider, CustomEdit // Get the model const model = await this.loadModel({ file: resource }); - // Load it (should already be visible) + // Load it return this.createNotebookEditor(model, panel); } catch (exc) { // Send telemetry indicating a failure