From b5dfacb12c60d9a7eb5a1a07155ffc6028e92288 Mon Sep 17 00:00:00 2001 From: zhbaor Date: Fri, 7 Feb 2025 23:36:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=97=B6=E6=94=AF=E6=8C=81Windows?= =?UTF-8?q?=E5=92=8CLinux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extension.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/extension.js b/extension.js index 2234985..64bbc84 100644 --- a/extension.js +++ b/extension.js @@ -1,5 +1,4 @@ const vscode = require("vscode"); -const path = require("path"); /** * @param {vscode.ExtensionContext} context @@ -33,15 +32,9 @@ function activate(context) { res_range.start.character + 1, res_range.end.character - 1 ); - console.log(res); if (!res.endsWith(".jpg")) res += ".png"; - const img_path = path.join( - vscode.workspace.workspaceFolders[0].uri.path, - "mower", - "resources", - ...res.split("/") - ); - const md = new vscode.MarkdownString(`![](file://${img_path})`); + const img_path = `file://${vscode.workspace.workspaceFolders[0].uri.path}/mower/resources/${res}`; + const md = new vscode.MarkdownString(`![${res}](${img_path})`); return new vscode.Hover(md); }, });