From 28c770c72bcc7c4e29f52d9dcc406fe509aee356 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Fri, 16 Feb 2024 13:39:32 +0800 Subject: [PATCH] fix(html): resolve reference behavior inconsistent with vscode --- packages/html/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/html/index.ts b/packages/html/index.ts index 1dadb55b..52620703 100644 --- a/packages/html/index.ts +++ b/packages/html/index.ts @@ -63,7 +63,11 @@ export function create({ return ref; } if (ref[0] === '/') { // resolve absolute path against the current workspace folder - return base + ref; + let folderUri = context.env.workspaceFolder; + if (!folderUri.endsWith('/')) { + folderUri += '/'; + } + return folderUri + ref.substr(1); } const baseUri = URI.parse(base); const baseUriDir = baseUri.path.endsWith('/') ? baseUri : Utils.dirname(baseUri);