Skip to content

Commit 32879da

Browse files
azizkprincemaple
authored andcommitted
Commands: ignore special folders when searching for test/code file.
Fix: find files in non-project windows as well.
1 parent e3499ff commit 32879da

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

commands/mix_test.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,19 @@ def run(self, _edit):
234234
is_test = parts[1:] == ['']
235235
search_names = \
236236
[parts[0] + ext for ext in ('.ex', '.exs')] if is_test else [file_path.stem + '_test.exs']
237+
ignored_folders = ['.elixir_ls', '_build', 'deps']
238+
239+
subpaths = [
240+
p
241+
for folder in (window.folders() or [reverse_find_root_folder(file_path)]) if folder
242+
for p in Path(folder).iterdir()
243+
if p.is_file() or p.name not in ignored_folders
244+
]
237245

238246
counterpart_paths = [
239-
(folder, p)
240-
for folder in window.folders()
241-
for p in Path(folder).rglob("*.ex*")
247+
(subpath, p)
248+
for subpath in subpaths
249+
for p in (subpath.rglob("*.ex*") if subpath.is_dir() else [subpath])
242250
if p.name in search_names
243251
]
244252

0 commit comments

Comments
 (0)