From 1f7ff27f7b78d53f60f9881c980c6d20393283ec Mon Sep 17 00:00:00 2001 From: Jaap Frolich Date: Tue, 3 Sep 2024 12:06:58 +0200 Subject: [PATCH] :ambulance: - Monorepo hotfix --- server/src/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/utils.ts b/server/src/utils.ts index 46c1afbec..2b22f0b4f 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -48,13 +48,12 @@ let findProjectRootOfFileInDir = ( // TODO: this doesn't handle file:/// scheme export let findProjectRootOfFile = ( source: p.DocumentUri, - skipParent?: boolean + allowDir?: boolean ): null | p.DocumentUri => { // First look in project files let foundRootFromProjectFiles: string | null = null; - for (const rootPath of projectsFiles.keys()) { - if (source.startsWith(rootPath) && (!skipParent || source !== rootPath)) { + if (source.startsWith(rootPath) && (!allowDir || source !== rootPath)) { // Prefer the longest path (most nested) if ( foundRootFromProjectFiles == null || @@ -70,7 +69,7 @@ export let findProjectRootOfFile = ( } else { const isDir = path.extname(source) === ""; return findProjectRootOfFileInDir( - isDir ? path.join(source, "dummy.res") : source + isDir && !allowDir ? path.join(source, "dummy.res") : source ); } };