From 933ff4e06a7527800062631950f5bc4fc5055aed Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Sun, 17 Jul 2022 15:59:16 +0200 Subject: [PATCH] Fix issue in finding bsc binary. Fixes https://github.com/rescript-lang/rescript-vscode/issues/496 --- server/src/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/server.ts b/server/src/server.ts index b82a799ee..8d6020cc2 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -617,7 +617,8 @@ function format(msg: p.RequestMessage): Array { } else { // code will always be defined here, even though technically it can be undefined let code = getOpenedFileContent(params.textDocument.uri); - let bscBinaryPath = findBscBinary(filePath); + let projectRootPath = utils.findProjectRootOfFile(filePath); + let bscBinaryPath = projectRootPath === null ? null : findBscBinary(projectRootPath); let formattedResult = utils.formatCode(bscBinaryPath, filePath, code); if (formattedResult.kind === "success") { let max = code.length;