From 50b0c9eb3b8916555ccd99ff276085c1f293e516 Mon Sep 17 00:00:00 2001 From: Nat Karmios Date: Tue, 20 May 2025 01:31:55 +0100 Subject: [PATCH 1/2] VSCode ext: add optional logging to SEDAPSession --- vscode/ext/src/SEDAPSession.ts | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/vscode/ext/src/SEDAPSession.ts b/vscode/ext/src/SEDAPSession.ts index 4425e23..216a8fe 100644 --- a/vscode/ext/src/SEDAPSession.ts +++ b/vscode/ext/src/SEDAPSession.ts @@ -21,6 +21,7 @@ export type SEDAPSessionPartialProps = { webviewOptions?: WebviewPanelOptions & WebviewOptions; webviewShowOptions?: ViewColumn | { viewColumn: ViewColumn; preserveFocus?: boolean }; showPanel?: boolean; + log?: boolean; }; export type SEDAPSessionProps = SEDAPSessionPartialProps & { @@ -45,8 +46,15 @@ export default class SEDAPSession implements Disposable { private disposables: Disposable[] = []; private disposed = false; private disposeListeners: ((session: SEDAPSession) => void)[] = []; + private log_ = false; // #endregion + private log(...data: unknown[]) { + if (this.log_) { + console.log("SEDAP:", ...data); + } + } + private async cusomDebuggerCommand( command: T, args: SEDAPCommandArgs, @@ -126,9 +134,11 @@ export default class SEDAPSession implements Disposable { return; } if (this.panel) { + this.log("SEDAP: Revealing existing panel", { this: this }); this.panel.reveal(); } else { this.createWebview(); + this.log("SEDAP: Created webview", { this: this }); } } @@ -149,10 +159,13 @@ export default class SEDAPSession implements Disposable { public dispose() { if (!this.disposed) { + this.log("SEDAP: Disposing...", { this: this }); this.disposables.forEach((x) => x.dispose()); this.panel?.dispose(); this.disposeListeners.forEach((f) => f(this)); this.disposed = true; + } else { + this.log("SEDAP: Already disposed!", { this: this }); } } @@ -164,6 +177,7 @@ export default class SEDAPSession implements Disposable { webviewOptions = {}, webviewShowOptions = ViewColumn.Two, showPanel = false, + log = false, }: SEDAPSessionProps) { this.panelName = panelName || session.name; this.panelIcon = panelIcon; @@ -172,6 +186,9 @@ export default class SEDAPSession implements Disposable { this.webviewOptions = { ...defaultWebviewOptions, ...webviewOptions }; this.webviewShowOptions = webviewShowOptions; this.getWebviewHtml = getWebviewHtml; + this.log_ = log; + + this.log("SEDAP: Session started", { this: this }); vscode.debug.onDidReceiveDebugSessionCustomEvent( ({ session, event, body }) => { @@ -183,11 +200,16 @@ export default class SEDAPSession implements Disposable { this.disposables, ); - vscode.debug.onDidTerminateDebugSession((session) => { - if (session.id === this.session.id) { - this.dispose(); - } - }); + vscode.debug.onDidTerminateDebugSession( + (session) => { + this.log("SEDAP: Session terminated", { this: this, other: session }); + if (session.id === this.session.id) { + this.dispose(); + } + }, + this, + this.disposables, + ); if (showPanel) { this.showWebviewPanel(); From 232bddda103b66b9343f4ad05996755fe32d45f8 Mon Sep 17 00:00:00 2001 From: Nat Karmios Date: Tue, 20 May 2025 01:36:35 +0100 Subject: [PATCH 2/2] Bump version --- package.json | 2 +- react/package.json | 4 ++-- types/package.json | 2 +- vscode/ext/package.json | 6 +++--- vscode/types/package.json | 4 ++-- vscode/ui/package.json | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 116b7d8..f970714 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap", - "version": "0.0.3", + "version": "0.0.4", "description": "Monorepo for JavaScript libraries for SEDAP", "repository":"https://github.com/gillianplatform/sedap-js", "workspaces": [ diff --git a/react/package.json b/react/package.json index 51efa6d..7f6f951 100644 --- a/react/package.json +++ b/react/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-react", - "version": "0.0.3", + "version": "0.0.4", "description": "React components for SEDAP", "repository":"https://github.com/gillianplatform/sedap-js", "type": "module", @@ -27,7 +27,7 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", "@storybook/addon-essentials": "^8.4.7", "@storybook/addon-interactions": "^8.4.7", "@storybook/addon-onboarding": "^8.4.7", diff --git a/types/package.json b/types/package.json index 9931563..416a39e 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-types", - "version": "0.0.3", + "version": "0.0.4", "description": "SEDAP types for TypeScript", "repository":"https://github.com/gillianplatform/sedap-js", "types": "./src/index.d.ts", diff --git a/vscode/ext/package.json b/vscode/ext/package.json index 819aa24..19cf043 100644 --- a/vscode/ext/package.json +++ b/vscode/ext/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-ext", - "version": "0.0.3", + "version": "0.0.4", "description": "SEDAP-related utilities for VSCode extensions", "repository":"https://github.com/gillianplatform/sedap-js", "type": "commonjs", @@ -27,8 +27,8 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", - "@gillianplatform/sedap-vscode-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-vscode-types": "0.0.4", "@types/vscode": "^1.96.0", "@typescript-eslint/eslint-plugin": "^8.18.2", "@typescript-eslint/parser": "^8.18.2", diff --git a/vscode/types/package.json b/vscode/types/package.json index 93fc626..4698edc 100644 --- a/vscode/types/package.json +++ b/vscode/types/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-types", - "version": "0.0.3", + "version": "0.0.4", "description": "Types for SEDAP VSCode helper libraries", "repository":"https://github.com/gillianplatform/sedap-js", "types": "./src/index.d.ts", @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@gillianplatform/sedap-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", "typescript": "^5.7.2" } } diff --git a/vscode/ui/package.json b/vscode/ui/package.json index ea6ff51..2947334 100644 --- a/vscode/ui/package.json +++ b/vscode/ui/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-ui", - "version": "0.0.3", + "version": "0.0.4", "description": "SEDAP-related utilities for webviews inside VSCode extensions", "repository":"https://github.com/gillianplatform/sedap-js", "type": "module", @@ -25,8 +25,8 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", - "@gillianplatform/sedap-vscode-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-vscode-types": "0.0.4", "@types/react": "^19.0.2", "@types/vscode-webview": "^1.57.5", "@typescript-eslint/eslint-plugin": "^8.18.2", @@ -46,7 +46,7 @@ "vite-plugin-dts": "^4.4.0" }, "peerDependencies": { - "@gillianplatform/sedap-react": "0.0.3", + "@gillianplatform/sedap-react": "0.0.4", "react": "^19.0.0", "react-icons": "^5.4.0" },