File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ def src_paths(nvim):
120
120
return {'src' , * nvim .vars .get ('acid_alt_paths' , [])}
121
121
122
122
def get_stop_paths (nvim ):
123
- return {'test' , 'src' }
123
+ return {'test' , 'src' , * test_paths ( nvim ), * src_paths ( nvim ) }
124
124
125
125
def find_file_in_path (nvim , msg ):
126
126
fname = msg ['file' ]
Original file line number Diff line number Diff line change 1
1
import os
2
+ import re
2
3
from acid .nvim .log import log_debug , log_warning
3
4
4
5
5
6
def path_to_ns (path , stop_paths = None ):
6
7
if stop_paths is None :
7
8
stop_paths = ['src' , 'test' ]
8
9
9
- path = path . replace ( "_" , "-" ). split ('/' )[ 1 :]
10
- path [ - 1 ] = path [ - 1 ]. split ( '.' )[ 0 ]
10
+ stop_paths = sorted ( stop_paths , key = lambda x : x . count ('/' ))
11
+
11
12
raw_path_list = None
12
13
13
- for ix , node in enumerate (reversed (path )):
14
- if node in stop_paths :
15
- raw_path_list = path [ix * - 1 :]
14
+ for stop_path in reversed (stop_paths ):
15
+ m = re .search (stop_path , path )
16
+ if m :
17
+ raw_path_list = path [m .start ():].replace ("_" , "-" ).split ('/' )[stop_path .count ('/' ) + 1 :]
18
+ raw_path_list [- 1 ] = raw_path_list [- 1 ].split ('.' )[0 ]
16
19
break
17
20
18
21
if raw_path_list is None :
19
22
log_debug ("Previous check did not work. Attempting project.clj" )
20
23
21
24
# Look for project.clj
25
+ path = path .replace ("_" , "-" ).split ('/' )[1 :]
26
+ path [- 1 ] = path [- 1 ].split ('.' )[0 ]
22
27
for ix , _ in enumerate (path ):
23
28
if os .path .exists (os .path .join (* ["/" , * path [:ix ], "project.clj" ])):
24
29
raw_path_list = path [ix + 1 :]
You can’t perform that action at this time.
0 commit comments