ncm2 / ncm2-pyclang

Cached, fast C/C++ completion for ncm2
MIT License
45 stars 1 forks source link

find .clang_complete from scm dir first #1

Closed fcying closed 6 years ago

fcying commented 6 years ago

Some projects are not convenient to add .clang_complete to the root directory, so add scm dir to the search path.

roxma commented 6 years ago

I would prefer to add a g:ncm2_pyclang#database_path like option

For example:

let g:ncm2_pyclang#args_file_path = [".clang_complete"]

Then you could customize it as

let g:ncm2_pyclang#args_file_path = [".clang_complete", ".svn/.clang_complete", ".git/clang_complete", ...]
fcying commented 6 years ago

If found config in scm_dir, the run_dir is set to the project root, not set to the file dir, so I have to identify scm_dir. Can I add a option to search form scm_dir?

let g:ncm2_pyclang#args_file_search_scm = ['.git', '.svn']

or identify which dir is scm:

let g:ncm2_pyclang#scm_dirs = ['.git', '.svn']
let g:ncm2_pyclang#args_file_path = [".clang_complete", ".svn/.clang_complete", ".git/clang_complete", ...]
jsfaint commented 6 years ago

@fcying There is an option g:ncm2_pyclang#args_file_path existed, maybe it's a good choice to extend it directly.

fcying commented 6 years ago

It can work fine with .git/.clang_complete, thanks~

fcying commented 6 years ago

a little problem: if use abs path, the isfile check can't work fine.

p = join(d, name)
if isfile(p):
    if isabs(name):
        return p, dirname(name)
    else:
        return p, d

call isabs at first?

if isabs(name):
    if isfile(name):
        return name, dirname(name)
else:
    p = join(d, name)
    if isfile(p):
        return p, d
roxma commented 6 years ago

isabs is removed in latest version.

it doesn't seem to be needed

fcying commented 6 years ago

I thought it was added to support abspath, then there is no problem.