-
Notifications
You must be signed in to change notification settings - Fork 108
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
clangd failed to find compilation database for dependency code #175
Comments
Adding a specific compilation database config does not fix the issue. > cat .clangd
CompileFlags:
CompilationDatabase: /path/to/bazel-example |
But if adds a command line option |
clangd/clangd#649 (comment) explains why
|
Hey @modatwork! Just seeing this. I really wish clangd had designed their behavior the other way. All is exactly as you determined--that's why we encourage --compile-commands-dir in the README. As far as I know, it's the only way to have the compile_command.json apply to all the files. Is there anything you think we should add to the README to help others get through this more easily--and if so, would you be down to make a quick edit? Additionally, it might be worth chiming in on those clangd issues, so they're more likely to factor in these (common) use cases. Hope this means it's back to being useful for you! |
Hi cpsauer, thanks for replying. I'm still trying to find the best way to set the clangd config for Neovim because Neovim created another LSP client for the code in Bazel's outputBase. After that I'd like to share my finding. |
I think the move is to set configuration via flags instead--but please do lmk if you find a way to do otherwise. |
Thanks for the tool. I have succeed to generate compilation database for envoy and it works great.
But when using envoy as a library to build my customized proxy, clangd failed to parse the code in dependency. The usage is similar to the way istio/proxy https://github.com/istio/proxy/blob/e7c2818121f5bb3a3cb2cb11894652a9d9b0328b/WORKSPACE#L36 uses envoy.
The envoy project is too huge to built so I created a simple demo which has an external dependency and it has the same problem. Here is the steps to reproduce the issue with the demo project.
The following steps are tested on macOS 13.5.2, clangd 18.1.1 and bazel 6.3.2. I also tested with the latest bazel version 7.1.0 and the issue remains.
After jumping to the definition of add function the LSP server complains:
There is a compile_commands.json file in the bazel-example directory which has compile command for "external/foo/foo". But it's not used by clangd.
The text was updated successfully, but these errors were encountered: