From 3531b8af3897cb42682c7f36fef80091a401f261 Mon Sep 17 00:00:00 2001 From: c-bata Date: Fri, 1 Mar 2024 22:11:55 +0900 Subject: [PATCH] Fix the bug of code-server extension --- README.md | 3 --- docs/getting-started.rst | 3 --- vscode/CHANGELOG.md | 18 +++++++++++++++++- vscode/README.md | 15 --------------- vscode/package-lock.json | 4 ++-- vscode/package.json | 2 +- vscode/src/web/extension.ts | 30 ++++++++++++++++++++++++------ 7 files changed, 44 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 2a2ee515..0df883e6 100644 --- a/README.md +++ b/README.md @@ -112,9 +112,6 @@ or install the code-server extension via [Open VSX](https://open-vsx.org/extensi Please right-click the SQLite3 files (`*.db` or `*.sqlite3`) in the VS Code file explorer and select the "Open in Optuna Dashboard" command from the dropdown menu. This extension leverages the browser-only version of Optuna Dashboard, so the same limitations apply. -Please note that we have confirmed the behavior of the code-server extension can be unstable. -When opening SQLite files, the dashboard may not appear on the first attempt, but it should be displayed upon a second try. - ## Submitting patches If you want to contribute, please check [Developers Guide](./CONTRIBUTING.md). diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 3179d3f5..3375c469 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -228,9 +228,6 @@ or install the code-server extension via `Open VSX { + switch (message.type) { + case 'webviewDidLoad': + console.log("[host] Receive a webviewDidLoad event.") + const storageContentBase64 = await readFileAsBase64(fileUri) + panel.webview.postMessage({ + type: "optunaStorage", + content: storageContentBase64, + }) + break + } + } + ); } ) @@ -58,12 +66,22 @@ function uint8ArrayToBase64(uint8Array: Uint8Array): string { } function getWebviewContent(indexJsUri: vscode.Uri): string { + // https://code.visualstudio.com/api/extension-guides/webview#passing-messages-from-a-webview-to-an-extension return ` Optuna Dashboard (Wasm ver.) +