Skip to content

[bug-maybe] Clangd Plugin Fails to Resolve Header Files in .conan2 Directory Despite Correct compile_commands.json #762

Open
@marco-hmc

Description

@marco-hmc

In an offline development environment, when working on a large project with nearly a million lines of code using VS Code and the Clangd plugin, the following issue occurs:

When attempting to navigate to header files located under the .conan2 directory, these files display a "file not found" error. Although the generated compile_commands.json file is correct, the Clangd plugin seems unable to properly parse and locate these header files.


Issue Description:

When working on a large project, the log output differs between the offline and online machines.

Offline Machine Log:

I[09:34:39.436] Failed to find compilation database for /home/marco/.conan2/p/xxxp/include/xxx.h
I[09:34:39.437] ASTWorker building file /home/marco/.conan2/p/xxx/include/gtest/internal/xxx.h version 1 with command clangd fallback

Online Machine Log:

I[09:34:39.436] Failed to find compilation database for /home/marco/.conan2/p/xxxp/include/xxx.h
I[09:34:39.437] ASTWorker building file /home/marco/.conan2/p/xxx/include/gtest/internal/xxx.h version 1 with command inferred from /home/marco/xxx.cpp

The key difference lies in how the commands are determined:

  • Offline Machine: Clangd falls back to a default configuration as it cannot infer the command from any specific source file.
  • Online Machine: Clangd successfully infers the command based on /home/marco/xxx.cpp, allowing it to parse and process the headers correctly.

Attempts to specify header file paths in settings.json were also unsuccessful on the offline machine.

This indicates that the offline machine is unable to resolve header file paths properly due to the lack of a valid compilation database or other essential project information. In contrast, the online machine can infer the necessary details and process the project as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions