File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,21 @@ local Path = require("plenary.path")
3
3
4
4
local M = {}
5
5
6
+ function M .mix_root (file_path )
7
+ local root = lib .files .match_root_pattern (" mix.exs" )(file_path )
8
+
9
+ -- If the path found is inside an umbrella, return the root of the umbrella
10
+ if root ~= nil and root :match (" /apps/[%w_]+$" ) then
11
+ local new_root = lib .files .match_root_pattern (" mix.exs" )(root :gsub (" /apps/[%w_]+$" , " " ))
12
+
13
+ return new_root or root
14
+ end
15
+
16
+ return root
17
+ end
18
+
6
19
local function relative_to_cwd (path )
7
- local root = lib . files . match_root_pattern ( " mix.exs " ) (path )
20
+ local root = M . mix_root (path )
8
21
return Path :new (path ):make_relative (root )
9
22
end
10
23
Original file line number Diff line number Diff line change @@ -40,12 +40,8 @@ local function post_process_command(cmd)
40
40
return cmd
41
41
end
42
42
43
- local function mix_root (file_path )
44
- return lib .files .match_root_pattern (" mix.exs" )(file_path )
45
- end
46
-
47
43
local function get_relative_path (file_path )
48
- local mix_root_path = mix_root (file_path )
44
+ local mix_root_path = core . mix_root (file_path )
49
45
local root_elems = vim .split (mix_root_path , Path .path .sep )
50
46
local elems = vim .split (file_path , Path .path .sep )
51
47
return table.concat ({ unpack (elems , (# root_elems + 1 ), # elems ) }, Path .path .sep )
@@ -70,7 +66,7 @@ function ElixirNeotestAdapter._generate_id(position, parents)
70
66
end
71
67
end
72
68
73
- ElixirNeotestAdapter .root = lib . files . match_root_pattern ( " mix.exs " )
69
+ ElixirNeotestAdapter .root = core . mix_root
74
70
75
71
function ElixirNeotestAdapter .filter_dir (_ , rel_path , _ )
76
72
return rel_path == " test"
You can’t perform that action at this time.
0 commit comments