From 3286654213623ad7318afe24658b3bfe5f56c0d6 Mon Sep 17 00:00:00 2001 From: Olivier Benz Date: Mon, 21 Nov 2022 16:50:38 +0100 Subject: [PATCH] backport #3410 to v1.2 --- src/command/preview/preview.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/command/preview/preview.ts b/src/command/preview/preview.ts index a0b226bfaf..d8d6ccb3df 100644 --- a/src/command/preview/preview.ts +++ b/src/command/preview/preview.ts @@ -72,6 +72,8 @@ import { isJupyterHubServer, isRStudioServer, isRStudioWorkbench, + isVSCodeServer, + vsCodeServerProxyUri, } from "../../core/platform.ts"; import { isJupyterNotebook } from "../../core/jupyter/jupyter.ts"; import { watchForFileChanges } from "../../core/watch.ts"; @@ -690,6 +692,9 @@ function pdfFileRequestHandler( if (new URL(req.url).pathname === "/") { const url = isRStudioWorkbench() ? await rswURL(port, kPdfJsInitialPath) + : isVSCodeServer() + ? vsCodeServerProxyUri()!.replace("{{port}}", `${port}`) + + kPdfJsInitialPath : "/" + kPdfJsInitialPath; return Promise.resolve(serveRedirect(url)); } else {