From 0f890751e19fbaf33320631571665080a578a149 Mon Sep 17 00:00:00 2001 From: Dayton Ellwanger Date: Tue, 28 Jul 2020 18:05:23 -0400 Subject: [PATCH] Bug fix for when guest requests file before it exists --- src/components/liveshare.ts | 4 ++-- src/components/manager.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/liveshare.ts b/src/components/liveshare.ts index d3e90c043..34e95521f 100644 --- a/src/components/liveshare.ts +++ b/src/components/liveshare.ts @@ -187,9 +187,9 @@ export class LiveShare { this.extension.logger.addCompilerMessage(`[Remote] ${message}`) } - async requestPdf(texPath: string) { + async requestPdf(texPath: string, forceFetch = false) { if (this.guestService) { - if (this.requestedPdfs.indexOf(texPath) < 0) { + if (this.requestedPdfs.indexOf(texPath) < 0 || forceFetch) { this.requestedPdfs.push(texPath) const p = async () => { const results = await this.guestService?.request(requestPdfRequestName, [texPath]) diff --git a/src/components/manager.ts b/src/components/manager.ts index 2db9f337e..0860c6546 100644 --- a/src/components/manager.ts +++ b/src/components/manager.ts @@ -188,8 +188,8 @@ export class Manager { */ tex2pdf(texPath: string, respectOutDir: boolean = true) { if (this.extension.liveshare.isGuest) { - this.extension.liveshare.requestPdf(texPath) const livesharePdfPath = path.join(this.getOutDir(texPath), path.basename(`${texPath.substr(0, texPath.lastIndexOf('.'))}.pdf`)) + this.extension.liveshare.requestPdf(texPath, !fs.existsSync(livesharePdfPath)) this.watchPdfFile(livesharePdfPath) return livesharePdfPath }