diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f41a6ed..44465bae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ - 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 - Use `compiler-info.json` to find the `@rescript/runtime` and `bsc.exe` if available. https://github.com/rescript-lang/rescript-vscode/pull/1129 - Add `Dump LSP Server State` command to client. https://github.com/rescript-lang/rescript-vscode/pull/1130 +- Use `compiler-info.json` to locate other binaries as well. https://github.com/rescript-lang/rescript-vscode/pull/1135 +- Detect Rewatch from workspace root. https://github.com/rescript-lang/rescript-vscode/pull/1135 ## 1.64.0 diff --git a/server/src/incrementalCompilation.ts b/server/src/incrementalCompilation.ts index 50be4f526..4b90178f4 100644 --- a/server/src/incrementalCompilation.ts +++ b/server/src/incrementalCompilation.ts @@ -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 ( @@ -262,6 +263,12 @@ function triggerIncrementalCompilationOfFile( } const projectRewatchLockfiles = [ + ...Array.from(workspaceFolders).map((w) => + 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), ]; diff --git a/server/src/server.ts b/server/src/server.ts index 24f0d3ee1..16515b415 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -31,7 +31,7 @@ import { projectsFiles } from "./projectFiles"; // Absolute paths to all the workspace folders // Configured during the initialize request -const workspaceFolders = new Set(); +export const workspaceFolders = new Set(); // This holds client capabilities specific to our extension, and not necessarily // related to the LS protocol. It's for enabling/disabling features that might diff --git a/server/src/utils.ts b/server/src/utils.ts index 3d44ccd5c..c64dbcc57 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -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, @@ -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 {} }