#Clangd in VSCode not working correctly; showing only namespace

9 messages · Page 1 of 1 (latest)

north sparrow
#

Hello, I installed the Clangd extension in VSCode, to use for my WSL2. I use cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON and it has finished indexing, and it works for some things. But when I hover over or try to ctrl+click a variable or function, it just shows the namespace which I am in, as in the screenshot (or goes to it for ctrl+click). In the screenshots, by the way, I am in a file myFile_def.hpp and in the namespace MueLu. Clangd is basically just pointing me back to MueLu in the same file.......

Even if the variable is declared in another file, it does not go to that file, it just goes to the top of this file to the namespace. I did everything right, I gave it the compile_commands.json and I have {workspace}/.vscode/settings.json:

{
  "cmake.sourceDirectory": "source",
  "clangd.serverPath": "/usr/bin/clangd",
  "clangd.arguments": [
    "--compile-commands-dir=build",
    "--query-driver=/usr/bin/clang++,/usr/bin/g++"
  ]
}

where {workspace} is the base directory in which source and build are located.

Any help is much appreciated, I don't know what is wrong. I don't know if this is the right tag, but hope it's ok.

quartz stumpBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

rare fossil
#

I didn't need a json file to make that work

#

🤷

#

Maybe try installing cpptools also?

#

You can still use diagnosis I'm not sure if you need extra feature from clang aside from that

#

This works fine