Closed thawk closed 4 years ago
when edit file parent_proj/lib/sub1/sub1_files
, the project manager should be able to find following path:
parent_proj/
parent_proj/lib/sub1/
if the project_rooter_outermost
option is true
, parent_proj/
should be used.
this is path tree
C:\Users\wsdjeg\Desktop\proj>tree /f
文件夹 PATH 列表
卷序列号为 0006-07CC
C:.
├─.git
└─lib
└─sub1
│ 新建文本文档.txt
│
└─.git
here is the log
[ SpaceVim ] [21:04:49] [ Info ] Start to find root for: C:/Users/wsdjeg/Desktop/proj/lib/sub1/新建文本文档.txt
[ SpaceVim ] [21:04:49] [ Info ] (.git/):C:/Users/wsdjeg/Desktop/proj/lib/sub1/
[ rooter ] [21:04:49] [ Info ] buffer name: C:\Users\wsdjeg\Desktop\proj\lib\sub1\新建文本文档.txt
[ rooter ] [21:04:49] [ Info ] change to root: C:/Users/wsdjeg/Desktop/proj/lib/sub1/
so the bug is, the rooter can only find (.git/):C:/Users/wsdjeg/Desktop/proj/lib/sub1/
there are two ways to improve this feature:
(.git/):C:/Users/wsdjeg/Desktop/proj/lib/sub1/
(.git/):C:/Users/wsdjeg/Desktop/proj/
project_rooter_outermost
, it will be faster.I think the second way is better.
In my similar code to find project root, I travel from cwd to root and check the existence of every pattern in the current level, returns the last one. With some caching, it seems to be fast enough.
yeah, we can use for loop to check if the path is directory, and return the last one. But if the pattern is a fuzzy pattern, for example *.conf
, we can not check it. the current implementation is using finddir()
function which only return the first match.
Hey, I found something in the document. finddir()
can return all matches, not only the first one. We don't need to use manual loop.
finddir({name} [, {path} [, {count}]])
...
When {count} is negative return all the matches in a |List|.
This is quite similar to the ex-command |:find|.
This issue should be fixed, please update spacevim.
Is your feature request related to a problem? Please describe. With
g:spacevim_project_rooter_outermost=true
, it only consider the most inner appearance of each pattern, and use the most outer one for difference patterns.For example, using subversion, it common for parent project to have external links to sub project. There are multiple
.svn/
in difference layer, like this:With
outermost=true
, we want the project root always beparent_proj/
, notsub1
orsub2
.Describe the solution you'd like
It
outermost=true
, the most outer appearance of the same pattern should be taken into account.If
outermost=false
, the most inner appearance of the same pattern should be taken into account instead.