Skip to content

Commit

Permalink
🚑 - Monorepo hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrolich committed Sep 3, 2024
1 parent 0b309d0 commit 1f7ff27
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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
);
}
};
Expand Down

0 comments on commit 1f7ff27

Please sign in to comment.