Skip to content

Commit 4bb6096

Browse files
authored
Merge pull request #1135 from nojaf/monorepo-fixes
Find other binaries via compiler-info.json
2 parents f477ca7 + a7601db commit 4bb6096

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
- Use `prepareRename` command (when a new enough ReScript version is used) to speed up the `rename` command. https://github.com/rescript-lang/rescript-vscode/pull/1124
2828
- Use `compiler-info.json` to find the `@rescript/runtime` and `bsc.exe` if available. https://github.com/rescript-lang/rescript-vscode/pull/1129
2929
- Add `Dump LSP Server State` command to client. https://github.com/rescript-lang/rescript-vscode/pull/1130
30+
- Use `compiler-info.json` to locate other binaries as well. https://github.com/rescript-lang/rescript-vscode/pull/1135
31+
- Detect Rewatch from workspace root. https://github.com/rescript-lang/rescript-vscode/pull/1135
3032

3133
## 1.64.0
3234

server/src/incrementalCompilation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { fileCodeActions } from "./codeActions";
1414
import { projectsFiles } from "./projectFiles";
1515
import { getRewatchBscArgs, RewatchCompilerArgs } from "./bsc-args/rewatch";
1616
import { BsbCompilerArgs, getBsbBscArgs } from "./bsc-args/bsb";
17+
import { workspaceFolders } from "./server";
1718

1819
export function debug() {
1920
return (
@@ -262,6 +263,12 @@ function triggerIncrementalCompilationOfFile(
262263
}
263264

264265
const projectRewatchLockfiles = [
266+
...Array.from(workspaceFolders).map((w) =>
267+
path.resolve(w, c.rewatchLockPartialPath),
268+
),
269+
...Array.from(workspaceFolders).map((w) =>
270+
path.resolve(w, c.rescriptLockPartialPath),
271+
),
265272
path.resolve(projectRootPath, c.rewatchLockPartialPath),
266273
path.resolve(projectRootPath, c.rescriptLockPartialPath),
267274
];

server/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { projectsFiles } from "./projectFiles";
3131

3232
// Absolute paths to all the workspace folders
3333
// Configured during the initialize request
34-
const workspaceFolders = new Set<string>();
34+
export const workspaceFolders = new Set<string>();
3535

3636
// This holds client capabilities specific to our extension, and not necessarily
3737
// related to the LS protocol. It's for enabling/disabling features that might

server/src/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ let findBinary = async (
9292
return path.join(config.extensionConfiguration.platformPath, binary);
9393
}
9494

95-
if (projectRootPath !== null && binary === "bsc.exe") {
95+
if (projectRootPath !== null) {
9696
try {
9797
const compilerInfo = path.resolve(
9898
projectRootPath,
@@ -101,7 +101,13 @@ let findBinary = async (
101101
const contents = await fsAsync.readFile(compilerInfo, "utf8");
102102
const compileInfo = JSON.parse(contents);
103103
if (compileInfo && compileInfo.bsc_path) {
104-
return compileInfo.bsc_path;
104+
const bsc_path = compileInfo.bsc_path;
105+
if (binary === "bsc.exe") {
106+
return bsc_path;
107+
} else {
108+
const binary_path = path.join(path.dirname(bsc_path), binary);
109+
return binary_path;
110+
}
105111
}
106112
} catch {}
107113
}

0 commit comments

Comments
 (0)