From 26e8198aa10c0a647d844c420b09da3e3277b061 Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Mon, 4 Nov 2019 20:52:45 +0900 Subject: [PATCH] we do not have to use Uri.file for paths of pdf files --- src/components/viewer.ts | 7 +++---- src/utils/utils.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/viewer.ts b/src/components/viewer.ts index 9e9b7299d..4bfb32796 100644 --- a/src/components/viewer.ts +++ b/src/components/viewer.ts @@ -106,23 +106,22 @@ export class Viewer { const pdfFile = this.extension.manager.tex2pdf(sourceFile, respectOutDir) this.clients[pdfFile.toLocaleUpperCase()] = this.clients[pdfFile.toLocaleUpperCase()] || [] - const uri = vscode.Uri.file(pdfFile).with({scheme: 'latex-workshop-pdf'}) const editor = vscode.window.activeTextEditor const panel = vscode.window.createWebviewPanel('latex-workshop-pdf', path.basename(pdfFile), sideColumn ? vscode.ViewColumn.Beside : vscode.ViewColumn.Active, { enableScripts: true, retainContextWhenHidden: true, portMapping : [{webviewPort: this.extension.server.port, extensionHostPort: this.extension.server.port}] }) - panel.webview.html = this.getPDFViewerContent(uri) + panel.webview.html = this.getPDFViewerContent(pdfFile) if (editor && sideColumn) { setTimeout(() => { vscode.window.showTextDocument(editor.document, editor.viewColumn) }, 500) } this.extension.logger.addLogMessage(`Open PDF tab for ${pdfFile}`) } - getPDFViewerContent(uri: vscode.Uri): string { + getPDFViewerContent(pdfFile: string): string { // viewer/viewer.js automatically requests the file to server.ts and server.ts decodes the encoded fsPath. - const url = `http://localhost:${this.extension.server.port}/viewer.html?incode=1&file=${encodePathWithPrefix(uri.fsPath)}` + const url = `http://localhost:${this.extension.server.port}/viewer.html?incode=1&file=${encodePathWithPrefix(pdfFile)}` return `