Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions server/src/incrementalCompilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { fileCodeActions } from "./codeActions";
import { projectsFiles } from "./projectFiles";
import { getRewatchBscArgs, RewatchCompilerArgs } from "./bsc-args/rewatch";
import { BsbCompilerArgs, getBsbBscArgs } from "./bsc-args/bsb";
import { workspaceFolders } from "./server";

export function debug() {
return (
Expand Down Expand Up @@ -262,6 +263,12 @@ function triggerIncrementalCompilationOfFile(
}

const projectRewatchLockfiles = [
...Array.from(workspaceFolders).map((w) =>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReScript lock was located at workspace level:
lib/rescript.lock
Was absent on packages/a/lib level, so it assumed bsb and failed.

path.resolve(w, c.rewatchLockPartialPath),
),
...Array.from(workspaceFolders).map((w) =>
path.resolve(w, c.rescriptLockPartialPath),
),
path.resolve(projectRootPath, c.rewatchLockPartialPath),
path.resolve(projectRootPath, c.rescriptLockPartialPath),
];
Expand Down
2 changes: 1 addition & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { projectsFiles } from "./projectFiles";

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

// This holds client capabilities specific to our extension, and not necessarily
// related to the LS protocol. It's for enabling/disabling features that might
Expand Down
10 changes: 8 additions & 2 deletions server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let findBinary = async (
return path.join(config.extensionConfiguration.platformPath, binary);
}

if (projectRootPath !== null && binary === "bsc.exe") {
if (projectRootPath !== null) {
try {
const compilerInfo = path.resolve(
projectRootPath,
Expand All @@ -101,7 +101,13 @@ let findBinary = async (
const contents = await fsAsync.readFile(compilerInfo, "utf8");
const compileInfo = JSON.parse(contents);
if (compileInfo && compileInfo.bsc_path) {
return compileInfo.bsc_path;
const bsc_path = compileInfo.bsc_path;
if (binary === "bsc.exe") {
return bsc_path;
} else {
const binary_path = path.join(path.dirname(bsc_path), binary);
return binary_path;
}
}
} catch {}
}
Expand Down