Skip to content

Commit 0187b75

Browse files
committed
fix local compilation when in a workspace
1 parent cd42e8b commit 0187b75

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

server/src/incrementalCompilation.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,24 @@ function triggerIncrementalCompilationOfFile(
390390
if (debug()) console.log("Did not find open project for " + filePath);
391391
return;
392392
}
393-
const workspaceRootPath = projectRootPath
394-
? utils.findProjectRootOfFile(projectRootPath, true)
395-
: null;
393+
394+
const projectRewatchLockfile = path.resolve(
395+
projectRootPath,
396+
c.rewatchLockPartialPath
397+
);
398+
399+
let foundRewatchLockfileInProjectRoot = false;
400+
try {
401+
fs.statSync(projectRewatchLockfile);
402+
foundRewatchLockfileInProjectRoot = true;
403+
} catch {}
404+
405+
// if we find a rewatch.lock in the project root, it's a compilation of a local package
406+
// in the workspace.
407+
const workspaceRootPath =
408+
projectRootPath && !foundRewatchLockfileInProjectRoot
409+
? utils.findProjectRootOfFile(projectRootPath, true)
410+
: null;
396411

397412
const bscBinaryLocation = project.bscBinaryLocation;
398413
if (bscBinaryLocation == null) {

0 commit comments

Comments
 (0)