Skip to content

Commit aced35c

Browse files
committed
fix
1 parent 1580d4e commit aced35c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

server/src/incrementalCompilation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ function triggerIncrementalCompilationOfFile(
376376
return;
377377
}
378378
const workspaceRootPath = projectRootPath
379-
? utils.findProjectRootOfFileInDir(projectRootPath)
379+
? utils.findProjectRootOfFile(projectRootPath, true)
380380
: null;
381+
console.log("Workspace root path: " + workspaceRootPath);
381382

382383
const bscBinaryLocation = project.bscBinaryLocation;
383384
if (bscBinaryLocation == null) {

server/src/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export let createFileInTempDir = (extension = "") => {
2525
return path.join(os.tmpdir(), tempFileName);
2626
};
2727

28-
export let findProjectRootOfFileInDir = (
28+
let findProjectRootOfFileInDir = (
2929
source: p.DocumentUri
3030
): null | p.DocumentUri => {
3131
let dir = path.dirname(source);
@@ -47,13 +47,14 @@ export let findProjectRootOfFileInDir = (
4747
// TODO: races here?
4848
// TODO: this doesn't handle file:/// scheme
4949
export let findProjectRootOfFile = (
50-
source: p.DocumentUri
50+
source: p.DocumentUri,
51+
skipParent?: boolean
5152
): null | p.DocumentUri => {
5253
// First look in project files
5354
let foundRootFromProjectFiles: string | null = null;
5455

5556
for (const rootPath of projectsFiles.keys()) {
56-
if (source.startsWith(rootPath)) {
57+
if (source.startsWith(rootPath) && (!skipParent || source !== rootPath)) {
5758
// Prefer the longest path (most nested)
5859
if (
5960
foundRootFromProjectFiles == null ||

0 commit comments

Comments
 (0)