xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

unable to get "complete" autocompletion when using compile_commands.json #455

Open ArnauPrat opened 9 years ago

ArnauPrat commented 9 years ago

Hi All, I am not able to get "complete" autocompletion when I try to use a compile_commands.json file generated from cmake. When I say complete, I mean I am getting autocomplation when accessing std:: members, but not from user defined libraries (i do if i use a .clang_complete file or I set the g:clang_user_options variable manually at startup). I have the following commands in my vimrc file:

 let g:clang_compilation_database = '/path/to/build'
 let g:clang_auto_user_options =  'compile_commands.json'

where '/path/to/build' is the path where the compile_commands.json file lays (and yes, it exists). I have tried to manually track the error and check that the directory is actually passed to the clang library by looking at the cindex.py file in the plugin, and everything seems correct and no errors are reported.

 cdb = conf.lib.clang_CompilationDatabase_fromDirectory(buildDir,
                 byref(errorCode))

Am I missing something? I might have something missconfigured

Thanks in advance, Arnau

butterflyfish commented 8 years ago

the same problem for me. help.

xaizek commented 8 years ago

I never tried using compile_commands.json, but if path is correct the next thing I'd check is that format of the file is still the same, paths are vaild (e.g., not relative to wrong directory or something like that) and values from that file is actually being passed to libclang. I guess this worked before for someone, but something goes wrong now at least for you.