Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from "path";

let platformDir =
export let platformDir =
process.arch == "arm64" ? process.platform + process.arch : process.platform;

// See https://microsoft.github.io/language-server-protocol/specification Abstract Message
Expand Down
22 changes: 19 additions & 3 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,28 @@ let findRescriptBinary = (projectRootPath: p.DocumentUri) =>
let findBscBinary = (projectRootPath: p.DocumentUri) => {
let rescriptBinaryPath = findRescriptBinary(projectRootPath);
if (rescriptBinaryPath !== null) {
return path.join(
let rescriptDirPath = path.join(
path.dirname(rescriptBinaryPath),
"..",
c.platformPath,
c.bscExeName
"rescript"
);

let bscBinaryPath = path.join(rescriptDirPath, c.platformDir, c.bscExeName);

// Workaround for darwinarm64 which has no folder yet in ReScript <= 9.1.4
if (
process.platform == "darwin" &&
process.arch == "arm64" &&
!fs.existsSync(bscBinaryPath)
) {
bscBinaryPath = path.join(
rescriptDirPath,
process.platform,
c.bscExeName
);
}

return bscBinaryPath;
}
return null;
};
Expand Down