diff --git a/CHANGELOG.md b/CHANGELOG.md index d43b4b5e8..898393cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Take namespace into account for incremental cleanup. https://github.com/rescript-lang/rescript-vscode/pull/1164 - Potential race condition in incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1167 - Fix extension crash triggered by incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/1169 +- Fix file watchers on Windows when using WSL. https://github.com/rescript-lang/rescript-vscode/pull/1178 #### :nail_care: Polish diff --git a/server/src/server.ts b/server/src/server.ts index 6bd4bfd56..f4829dd0e 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -1528,20 +1528,27 @@ async function onMessage(msg: p.Message) { // Only watch the root compiler log for each workspace folder. // In monorepos, `**/lib/bs/.compiler.log` matches every package and dependency, // causing a burst of events per save. - globPattern: path.join(projectRootPath, c.compilerLogPartialPath), + globPattern: { + baseUri: utils.pathToURI(projectRootPath), + pattern: c.compilerLogPartialPath, + }, kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, }, { - globPattern: path.join( - projectRootPath, - "**", - c.buildNinjaPartialPath, - ), + // Watch ninja output + globPattern: { + baseUri: utils.pathToURI(projectRootPath), + pattern: path.join("**", c.buildNinjaPartialPath), + }, kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, }, { - globPattern: `${path.join(projectRootPath, "**", c.compilerDirPartialPath)}/**/*.{cmt,cmi}`, - kind: p.WatchKind.Change | p.WatchKind.Delete, + // Watch build artifacts + globPattern: { + baseUri: utils.pathToURI(projectRootPath), + pattern: path.join(c.compilerDirPartialPath, "**/*.{cmi,cmt}"), + }, + kind: p.WatchKind.Change | p.WatchKind.Create | p.WatchKind.Delete, }, ], );