From 8a9d3e2b601717ab1b6900a6488d2565820be789 Mon Sep 17 00:00:00 2001 From: QianrenLi <908559578@qq.com> Date: Tue, 1 Apr 2025 21:43:07 +0800 Subject: [PATCH] fix: handle open file in compile disgnostic provider --- src/compile/compileManager.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/compile/compileManager.ts b/src/compile/compileManager.ts index a7d5735..c40dc6b 100644 --- a/src/compile/compileManager.ts +++ b/src/compile/compileManager.ts @@ -69,8 +69,17 @@ class CompileDiagnosticProvider { const vfs = await this.vfsm.prefetch(uri); const logPath = `${OUTPUT_FOLDER_NAME}/output.log`; const _uri = vfs.pathToUri(logPath); - let content =''; - content = new TextDecoder().decode(await vfs.openFile(_uri)); + let content = ''; + try { + const fileData = await vfs.openFile(_uri); + content = new TextDecoder().decode(fileData); + } catch (error) { + if (error instanceof vscode.FileSystemError && error.code === 'FileNotFound') { + return false; + } + console.error('Error reading log file:', error); + throw error; // Re-throw unexpected errors + } const logs = new LatexParser(content).parse(); if (logs === undefined) { return content === ''? true :false;