Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify compile_commands.json location? #14

Open
directorscut82 opened this issue May 22, 2017 · 7 comments
Open

specify compile_commands.json location? #14

directorscut82 opened this issue May 22, 2017 · 7 comments

Comments

@directorscut82
Copy link

Hello,
Is there a setting to specify a directory (different than the root) that the plugin can use
for the location of the compilation database??

@tweekmonster
Copy link
Owner

No. I couldn't think of a reason why compile_commands.json would be outside of the project directory. What's your scenario?

@stfl
Copy link

stfl commented Jun 12, 2017

I have the same issue..
I am using meson>ninja project setup where the src and build directories are separeted

/.lvimrc
  build/compile_comands.json
  src/

I ususally start vim within the /src dir.
deoplete-clang has

 let g:deoplete#sources#clang#clang_complete_database = g:localvimrc_script_dir.'/build'

@tweekmonster
Copy link
Owner

I'm not familiar with Meson, but I understand the problem now. I keep cwd as the project root so I don't have to screw around with paths in the compiler flags.

That variable is ignored in deoplete-clang2 (electric boogaloo). I consider compile_comands.json to be a project-specific thing, which makes having a fixed path using a global variable feel clumsy to me, even when using a local vim script. I prefer it to be automatic since it's all-or-nothing (there shouldn't be two compile_commands.json files per project).

This could search upward for a root repo directory then search for the compile_commands.json file from there. Could also have an option to specify a list of hints like let g:deoplete#sources#clang#compile_commands_search = ['../build'] (./ would always be the last resort). What do you think?

@stfl
Copy link

stfl commented Jun 19, 2017

yes. compile_commands.json is very project specific.. and for that I only set this in localvimrc anyway..

I think the search path should do the trick as well if you want to keep it more generic.
It would still be very project specific but would make it work out of the box for the majority of meson.build and cmake projects, or am I mistaken?

@stfl
Copy link

stfl commented Jun 20, 2017

I just figured out that the let g:deoplete#sources#clang#clang_complete_database = g:localvimrc_script_dir.'/build' in deoplete-clang doesn't actually work properly.. struct members are not copleted f.e.

I am now using the .clang file that has an option like: compilation_database = "<path to compilation_database>"

would be an alternative solution.. ?

@JonBoyleCoding
Copy link

I'd also like to note that the CMake build structure also uses a separate build directory than the source directory, so having some parameter somewhere would be useful.

As for now, a symlink does the job though.

@przem8k
Copy link

przem8k commented Jul 25, 2017

+1, a setting to specify a build directory containing the compilation database would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants