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

Clangd using clangd fallback even after loading compilation database #2025

Open
Anon258 opened this issue Apr 29, 2024 · 4 comments
Open

Clangd using clangd fallback even after loading compilation database #2025

Anon258 opened this issue Apr 29, 2024 · 4 comments

Comments

@Anon258
Copy link

Anon258 commented Apr 29, 2024

Running clangd restart language server after providing compile_commands.json path does not link all functions in project.
Clangd only running for the currently open file instead of all files in project, and using fallback mode even after detecting .json file

(${workspaceFolder}\Main\Build, workspace is at z:\Perforce\MyProject)

Ctrl+click does not link to any structs or functions outside the current file (even header file)

Logs

I[17:52:12.349] <-- textDocument/didOpen
I[17:52:13.659] Loaded compilation database from z:\Perforce\MyProject\Main\Build\compile_commands.json
V[17:52:13.661] Broadcasting compilation database from z:\Perforce\MyProject\Main\Build
I[17:52:13.661] ASTWorker building file z:\Perforce\MyProject\Main\Butterfly\Function\Folder\Advanced\Feature\Feature.c version 1 with command clangd fallback

System information

Output of clangd --version: 18.1.3

Editor/LSP plugin: VSCode

Operating system: Windows

@Anon258
Copy link
Author

Anon258 commented Apr 29, 2024

Edit: After more digging, I found out it is due to the compilation database path being set to ubuntu paths, after changing /home/user to z:, I am now getting the correct command for clangd, but I now get
"Failed to load shard" for all the files

Also, clangd only indexes a single file (currently open one), is there a way to index and link all the files in the project from the compilation database?
The arguments for clangd are

-log=verbose
-pretty
--background-index
--compile-commands-dir=${workspaceFolder}\Main\Build

@HighCommander4
Copy link

is there a way to index and link all the files in the project from the compilation database?

That should happen by default.

The log might contain clues as to why it's not working. Feel free to share a log for help analyzing it.

@Anon258
Copy link
Author

Anon258 commented May 2, 2024

I tried to get it to work by searching a variable in entire folder. But I am getting error "Failed to load shard: " for all the files in folder

@HighCommander4
Copy link

I tried to get it to work by searching a variable in entire folder.

I'm not sure what you mean by that.

But I am getting error "Failed to load shard: " for all the files in folder

I don't think that necessarily indicates a problem, I think that's printed whenever index files are out of date and need to be rebuilt.

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

2 participants