Skip to content

Commit fd23865

Browse files
authored
Fix extension crash triggered by incremental compilation
2 parents adf96f7 + cacee02 commit fd23865

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- Take namespace into account for incremental cleanup. https://github.com/rescript-lang/rescript-vscode/pull/1164
1818
- Potential race condition in incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1167
19+
- Fix extension crash triggered by incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1169
1920

2021
#### :nail_care: Polish
2122

server/src/incrementalCompilation.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { fileCodeActions } from "./codeActions";
1313
import { projectsFiles } from "./projectFiles";
1414
import { getRewatchBscArgs, RewatchCompilerArgs } from "./bsc-args/rewatch";
1515
import { BsbCompilerArgs, getBsbBscArgs } from "./bsc-args/bsb";
16-
import { getCurrentCompilerDiagnosticsForFile } from "./server";
1716
import { NormalizedPath } from "./utils";
1817
import { getLogger } from "./logger";
1918

@@ -712,7 +711,12 @@ async function compileContents(
712711
entry.project.bscBinaryLocation,
713712
callArgs,
714713
{ cwd, signal },
715-
);
714+
).catch((error) => {
715+
if (error.stderr) {
716+
return { stderr: error.stderr };
717+
}
718+
throw error;
719+
});
716720

717721
getLogger().log(
718722
`Recompiled ${entry.file.sourceFileName} in ${

0 commit comments

Comments
 (0)