diff --git a/CHANGELOG.md b/CHANGELOG.md index 650bed246..3e095205f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Take namespace into account for incremental cleanup. https://github.com/rescript-lang/rescript-vscode/pull/1164 - Potential race condition in incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1167 +- Fix extension crash triggered by incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1169 #### :nail_care: Polish diff --git a/server/src/incrementalCompilation.ts b/server/src/incrementalCompilation.ts index 1cc4e1ce8..da65b9d4d 100644 --- a/server/src/incrementalCompilation.ts +++ b/server/src/incrementalCompilation.ts @@ -13,7 +13,6 @@ import { fileCodeActions } from "./codeActions"; import { projectsFiles } from "./projectFiles"; import { getRewatchBscArgs, RewatchCompilerArgs } from "./bsc-args/rewatch"; import { BsbCompilerArgs, getBsbBscArgs } from "./bsc-args/bsb"; -import { getCurrentCompilerDiagnosticsForFile } from "./server"; import { NormalizedPath } from "./utils"; import { getLogger } from "./logger"; @@ -712,7 +711,12 @@ async function compileContents( entry.project.bscBinaryLocation, callArgs, { cwd, signal }, - ); + ).catch((error) => { + if (error.stderr) { + return { stderr: error.stderr }; + } + throw error; + }); getLogger().log( `Recompiled ${entry.file.sourceFileName} in ${