From 70fa3bc021bcac48bbd4a387f0c1bc60ff9c4d27 Mon Sep 17 00:00:00 2001 From: Duke Pan Date: Thu, 24 Oct 2024 20:41:12 -0700 Subject: [PATCH 1/3] Console logs for debugging trace of overlay startup --- .gitignore | 1 + src/vs/workbench/browser/layout.ts | 4 ++++ .../workbench/browser/parts/overlay/pearOverlayPart.ts | 10 +++++++++- src/vs/workbench/browser/workbench.ts | 7 +++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 74e52369abf16..bcce54865f0fa 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ product.overrides.json .vscode-test extensions/pearai-submodule extensions/pearai-ref +.prompts diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 0b68fda1b778a..cf66043cdae21 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -1484,6 +1484,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi const auxiliaryBarPart = this.getPart(Parts.AUXILIARYBAR_PART); const sideBar = this.getPart(Parts.SIDEBAR_PART); const statusBar = this.getPart(Parts.STATUSBAR_PART); + console.log("[Test: layout.ts] right before getPart") const pearOverlayPart = this.getPart(Parts.PEAROVERLAY_PART); // View references for all parts @@ -1510,6 +1511,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi pearOverlayPartContainer.style.backgroundColor = 'var(--vscode-editor-background)'; this.mainContainer.appendChild(pearOverlayPartContainer); + console.log("[Test: layout.ts] right before .create()") pearOverlayPart.create(pearOverlayPartContainer); const viewMap = { @@ -1589,7 +1591,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi size(this.mainContainer, this._mainContainerDimension.width, this._mainContainerDimension.height); // Layout the grid widget + console.log("[Test: layout.ts] layout workbench grid") this.workbenchGrid.layout(this._mainContainerDimension.width, this._mainContainerDimension.height); + console.log("[Test: layout.ts] right before pear.layout()") this.pearOverlayPartView.layout(this._mainContainerDimension.width, this._mainContainerDimension.height, 0, 0); this.initialized = true; diff --git a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts index 5af6ef93db1d9..4a59d3a976b6c 100644 --- a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts +++ b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts @@ -83,6 +83,7 @@ export class PearOverlayPart extends Part { this.webviewView = { webview, onDidChangeVisibility: () => { + console.log("[Test: pearOverlayPart.ts] visibility change") return { dispose: () => {} }; }, onDispose: () => { @@ -119,6 +120,7 @@ export class PearOverlayPart extends Part { // if both content and webview are ready, end loading state and open if (this.popupAreaOverlay && this.webviewView) { + console.log("[Test: pearOverlayPart.ts] LayoutWebviewOverElement") this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); // Don't open on every startup //this.open(); @@ -126,6 +128,7 @@ export class PearOverlayPart extends Part { // hide stuff while we load this.webviewView!.webview.container.style.display = "none"; } + console.log("[Test: pearOverlayPart.ts] Finished initializing") } protected override createContentArea(element: HTMLElement): HTMLElement { @@ -153,6 +156,7 @@ export class PearOverlayPart extends Part { // if both content and webview are ready, end loading state and open if (this.popupAreaOverlay && this.webviewView) { this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); + console.log("[Test: pearOverlayPart] Opening from createContentArea") this.open(); } else { // hide stuff while we load @@ -201,8 +205,10 @@ export class PearOverlayPart extends Part { private open() { if (this.state === "open") { + console.log("[Test: pearOverPart.ts] Already open") return; - } + } + console.log("[Test: in pearOverlayPart.ts] opening") this.state = "open"; this.fullScreenOverlay!.style.zIndex = "95"; @@ -223,8 +229,10 @@ export class PearOverlayPart extends Part { private close() { if (this.state === "closed") { + console.log("[Test: pearOverPart.ts] already closed") return; } + console.log("[Test: pearOverPart.ts] closing") this.state = "closed"; const container = this.webviewView!.webview.container; diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index 0885c15b572f1..9c73fa1b4415c 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -186,7 +186,7 @@ export class Workbench extends Layout { // Workbench Layout this.createWorkbenchLayout(); - + console.log("[Test: FINISHED WORKBENCH. LAYOUT TIME") // Layout this.layout(); @@ -370,17 +370,20 @@ export class Workbench extends Layout { { id: Parts.PANEL_PART, role: 'none', classes: ['panel', 'basepanel', positionToString(this.getPanelPosition())] }, { id: Parts.AUXILIARYBAR_PART, role: 'none', classes: ['auxiliarybar', 'basepanel', this.getSideBarPosition() === Position.LEFT ? 'right' : 'left'] }, { id: Parts.STATUSBAR_PART, role: 'status', classes: ['statusbar'] }, - { id: Parts.PEAROVERLAY_PART, role: 'none', classes: [] } + { id: Parts.PEAROVERLAY_PART, role: 'none', classes: ['overlay'] } ]) { + console.log("[Test: workbench.ts] right before createPart") const partContainer = this.createPart(id, role, classes); if (id === Parts.PEAROVERLAY_PART) { instantiationService.invokeFunction(accessor => { + console.log("[Test: workbench.ts] within accessor.get(IPearOverlayService)") accessor.get(IPearOverlayService); }); } mark(`code/willCreatePart/${id}`); + console.log("[Test: workbench.ts] right before getPart .create") this.getPart(id).create(partContainer, options); mark(`code/didCreatePart/${id}`); } From 4018680f9d91e48f6c8389f05f77420be97d1ba3 Mon Sep 17 00:00:00 2001 From: Duke Pan Date: Thu, 24 Oct 2024 20:41:28 -0700 Subject: [PATCH 2/3] Revert "Console logs for debugging trace of overlay startup" This reverts commit 70fa3bc021bcac48bbd4a387f0c1bc60ff9c4d27. --- .gitignore | 1 - src/vs/workbench/browser/layout.ts | 4 ---- .../workbench/browser/parts/overlay/pearOverlayPart.ts | 10 +--------- src/vs/workbench/browser/workbench.ts | 7 ++----- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index bcce54865f0fa..74e52369abf16 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ product.overrides.json .vscode-test extensions/pearai-submodule extensions/pearai-ref -.prompts diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index cf66043cdae21..0b68fda1b778a 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -1484,7 +1484,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi const auxiliaryBarPart = this.getPart(Parts.AUXILIARYBAR_PART); const sideBar = this.getPart(Parts.SIDEBAR_PART); const statusBar = this.getPart(Parts.STATUSBAR_PART); - console.log("[Test: layout.ts] right before getPart") const pearOverlayPart = this.getPart(Parts.PEAROVERLAY_PART); // View references for all parts @@ -1511,7 +1510,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi pearOverlayPartContainer.style.backgroundColor = 'var(--vscode-editor-background)'; this.mainContainer.appendChild(pearOverlayPartContainer); - console.log("[Test: layout.ts] right before .create()") pearOverlayPart.create(pearOverlayPartContainer); const viewMap = { @@ -1591,9 +1589,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi size(this.mainContainer, this._mainContainerDimension.width, this._mainContainerDimension.height); // Layout the grid widget - console.log("[Test: layout.ts] layout workbench grid") this.workbenchGrid.layout(this._mainContainerDimension.width, this._mainContainerDimension.height); - console.log("[Test: layout.ts] right before pear.layout()") this.pearOverlayPartView.layout(this._mainContainerDimension.width, this._mainContainerDimension.height, 0, 0); this.initialized = true; diff --git a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts index 4a59d3a976b6c..5af6ef93db1d9 100644 --- a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts +++ b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts @@ -83,7 +83,6 @@ export class PearOverlayPart extends Part { this.webviewView = { webview, onDidChangeVisibility: () => { - console.log("[Test: pearOverlayPart.ts] visibility change") return { dispose: () => {} }; }, onDispose: () => { @@ -120,7 +119,6 @@ export class PearOverlayPart extends Part { // if both content and webview are ready, end loading state and open if (this.popupAreaOverlay && this.webviewView) { - console.log("[Test: pearOverlayPart.ts] LayoutWebviewOverElement") this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); // Don't open on every startup //this.open(); @@ -128,7 +126,6 @@ export class PearOverlayPart extends Part { // hide stuff while we load this.webviewView!.webview.container.style.display = "none"; } - console.log("[Test: pearOverlayPart.ts] Finished initializing") } protected override createContentArea(element: HTMLElement): HTMLElement { @@ -156,7 +153,6 @@ export class PearOverlayPart extends Part { // if both content and webview are ready, end loading state and open if (this.popupAreaOverlay && this.webviewView) { this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); - console.log("[Test: pearOverlayPart] Opening from createContentArea") this.open(); } else { // hide stuff while we load @@ -205,10 +201,8 @@ export class PearOverlayPart extends Part { private open() { if (this.state === "open") { - console.log("[Test: pearOverPart.ts] Already open") return; - } - console.log("[Test: in pearOverlayPart.ts] opening") + } this.state = "open"; this.fullScreenOverlay!.style.zIndex = "95"; @@ -229,10 +223,8 @@ export class PearOverlayPart extends Part { private close() { if (this.state === "closed") { - console.log("[Test: pearOverPart.ts] already closed") return; } - console.log("[Test: pearOverPart.ts] closing") this.state = "closed"; const container = this.webviewView!.webview.container; diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index 9c73fa1b4415c..0885c15b572f1 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -186,7 +186,7 @@ export class Workbench extends Layout { // Workbench Layout this.createWorkbenchLayout(); - console.log("[Test: FINISHED WORKBENCH. LAYOUT TIME") + // Layout this.layout(); @@ -370,20 +370,17 @@ export class Workbench extends Layout { { id: Parts.PANEL_PART, role: 'none', classes: ['panel', 'basepanel', positionToString(this.getPanelPosition())] }, { id: Parts.AUXILIARYBAR_PART, role: 'none', classes: ['auxiliarybar', 'basepanel', this.getSideBarPosition() === Position.LEFT ? 'right' : 'left'] }, { id: Parts.STATUSBAR_PART, role: 'status', classes: ['statusbar'] }, - { id: Parts.PEAROVERLAY_PART, role: 'none', classes: ['overlay'] } + { id: Parts.PEAROVERLAY_PART, role: 'none', classes: [] } ]) { - console.log("[Test: workbench.ts] right before createPart") const partContainer = this.createPart(id, role, classes); if (id === Parts.PEAROVERLAY_PART) { instantiationService.invokeFunction(accessor => { - console.log("[Test: workbench.ts] within accessor.get(IPearOverlayService)") accessor.get(IPearOverlayService); }); } mark(`code/willCreatePart/${id}`); - console.log("[Test: workbench.ts] right before getPart .create") this.getPart(id).create(partContainer, options); mark(`code/didCreatePart/${id}`); } From 2e277278ad44784ddae1bb263e23a29838b09d2e Mon Sep 17 00:00:00 2001 From: Duke Pan Date: Thu, 24 Oct 2024 20:44:00 -0700 Subject: [PATCH 3/3] Fix overlay appearing for half a second on startup --- .gitignore | 1 + src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 74e52369abf16..bcce54865f0fa 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ product.overrides.json .vscode-test extensions/pearai-submodule extensions/pearai-ref +.prompts diff --git a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts index 5af6ef93db1d9..5bd2388c4e4cd 100644 --- a/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts +++ b/src/vs/workbench/browser/parts/overlay/pearOverlayPart.ts @@ -152,8 +152,11 @@ export class PearOverlayPart extends Part { // if both content and webview are ready, end loading state and open if (this.popupAreaOverlay && this.webviewView) { - this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); - this.open(); + //this.webviewView?.webview.layoutWebviewOverElement(this.popupAreaOverlay); + // createContentArea is called within the workbench and layout when instantiating the overlay. + // If we don't close it here, it will open up by default when editor starts, or appear for half a second. + // If we remove this completely, it gets stuck in the loading stage, so we must close it. + this.close(); } else { // hide stuff while we load this.fullScreenOverlay!.style.display = "none";