bazel-compile-commands icon indicating copy to clipboard operation
bazel-compile-commands copied to clipboard

"Go to" opens header in `~/.cache/bazel` instead of in source tree

Open arvid-norlander opened this issue 7 months ago • 5 comments

When using this with VSCode & clangd, ctrl-clicking on a header (or class) to go to it, opens a header like: ~/.cache/bazel/.../bazel-out/k8-dbg/bin/.../MyHeader.h or even ~/.cache/bazel/.../bazel-out/k8-dbg/bin/external/some_submodule+/.../MyHeader.h when combined with a local path override to a gitsubmodule for a bazel module.

This means that the file tree in VSCode is not kept in sync when navigating between files. Also when navigating from a header file to a source file and then back to the header file, I now have the header file open twice.

Would it be possible to patch the include paths in the generated compile_commands.json to point to the original directory / file?

This is when using Bazel on Linux.

arvid-norlander avatar Mar 17 '25 10:03 arvid-norlander