Code Navigation doesn't work completely

I use VsCode with clangd+compile_commands.json. Seems must of the syntax highlighting and code navigation is working. However, in one module there’s a problem parsing a variable accessed through namespaces that are defined in another class.

ayd::v1:MY_VAR - assigning this to a variable/as param in function within the affected class will cause raise the issue. can’t CTRL+click to go to definition. Typing it directly in the affected class will have code completion and CTRL+click works

Another example is with using dataDemands_t = std::vector; which is defined in a separate header. The error in this cause is “unknown type”. This header is indirectly included by including a different header which has an include with error “file not found”. Is this error the reason clangd stopped parsing the file? At some point there was an error in the ouput “Too many errors emitted, stopping now” as well.

Clangd does require headers to be self-contained (see Support non-self-contained files · Issue #45 · clangd/clangd · GitHub).

Beyond that, it’s hard to comment on specific issues without having a complete code example to look at.

I inspected the compile_commands.json and it’s including external paths to look for certain headers. There’s a header in one of these external libraries that includes a different header. This in turn cannot be found by clangd. I’ve tested to include the path to this header in the compile_commands.json and it resolved the issue. CLion and C++ Extension for vscode managed to find. Is there a way to add include paths for clangd to look for headers or any alternative to resolve the issue? It’s a big corporate project where added changes to build files might not be an option.

compile_commands.json will define paths to:
A header inside /repo/interfaces/A100/inc is including a header residing in /repo/interfaces/B200/inc
Clangd cannot find the header residing in /repo/interfaces/B200/inc because it’s not included in compile_commands.json