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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

- Fix: bug where incremental compilation crashes when rewatch is being run in a specific package vs the root of the monorepo. https://github.com/rescript-lang/rescript-vscode/pull/1082

- Fix: Absence of Node.js does not hinder LSP server. https://github.com/rescript-lang/rescript-vscode/pull/1083

## 1.62.0

#### :nail_care: Polish
Expand Down
23 changes: 9 additions & 14 deletions server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,31 @@ export let findReScriptVersion = (
return undefined;
}

let rescriptBinary = lookup.findFilePathFromProjectRoot(
projectRoot,
path.join(c.nodeModulesBinDir, c.rescriptBinName)
);
const bscExe = findBinary(findPlatformPath(projectRoot), c.bscExeName);

if (rescriptBinary == null) {
if (bscExe == null) {
return undefined;
}

try {
let version = childProcess.execSync(`${rescriptBinary} -v`);
return version.toString().trim();
let version = childProcess.execSync(`${bscExe} -v`);
return version.toString().replace(/rescript/gi, "").trim();
} catch (e) {
console.error("rescrip binary failed", e);
return undefined;
}
};

export function findReScriptVersionForProjectRoot(projectRootPath:string) : string | undefined {
let rescriptBinary = lookup.findFilePathFromProjectRoot(
projectRootPath,
path.join(c.nodeModulesBinDir, c.rescriptBinName)
);
const bscExe = findBinary(findPlatformPath(projectRootPath), c.bscExeName);

if (rescriptBinary == null) {
if (bscExe == null) {
return undefined;
}

try {
let version = childProcess.execSync(`${rescriptBinary} -v`);
return version.toString().trim();
let version = childProcess.execSync(`${bscExe} -v`);
return version.toString().replace(/rescript/gi, "").trim();
} catch (e) {
return undefined;
}
Expand Down