Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit de1fed8

Browse files
committed
Account for umbrella projects when determining project path
1 parent b65bb82 commit de1fed8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/init.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ const findElixirProjectPath = async (editorPath) => {
3131
const editorDir = dirname(editorPath);
3232
const mixexsPath = find(editorDir, 'mix.exs');
3333
if (mixexsPath !== null) {
34+
const pathArray = mixexsPath.split('/');
35+
if (pathArray.length > 3 && pathArray[pathArray.length - 3] === 'apps') {
36+
// Treat this as an umbrella app. This may be wrong -
37+
// If you happen to keep your code in a directory called 'apps'
38+
pathArray.splice((pathArray.length - 3), 3);
39+
const umbrellaProjectPath = pathArray.join('/');
40+
41+
// Safety check by looking for a `mix.exs` file in the same directory as
42+
// 'apps'. If it exists, then it's likely an umbrella project
43+
if (existsSync(join(umbrellaProjectPath, 'mix.exs'))) {
44+
return umbrellaProjectPath;
45+
}
46+
}
3447
return dirname(mixexsPath);
3548
}
3649
const projPath = atom.project.relativizePath(editorPath)[0];

0 commit comments

Comments
 (0)