microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

cmake-tools not generating configuration for intellisense, and compile_commands.json is empty #2048

Closed adelejjeh closed 2 years ago

adelejjeh commented 3 years ago

Brief Issue Summary

CMake Tools not generating configuration for cpp intellisense, and the compile_commands.json file it generates is empty. I know this is an issue with the extension because I am able to generate a compile_commands.json file when run cmake manually in the terminal.

Expected:

When I configure my project with cmake, cpptools should be able to receive the configuration and use it for intellisense. I have the following line in my c_cpp_properties.json:

"configurationProvider": "ms-vscode.cmake-tools",
"compileCommands": ""${workspaceFolder}/build/hpvm/compile_commands.json"

Also, the generated compile_commands.json should not be empty.

Apparent Behavior:

cpptools is unable to get the configuration from cmake-tools, so it tries to parse the compile_commands.json but issues an error saying unable to parse it. When I checked the contents of the compile commands, the file was empty. I am currently manually running cmake after I build in vscode to recreate the compile_commands.json for intellisense to work.

CMake Tools Log

N.A.

Developer Tools Log

[8/11/2021, 5:27:58 PM] "${workspaceFolder}/hpvm/build/compile_commands.json" could not be parsed. 'includePath' from c_cpp_properties.json in folder 'hpvm-hm' will be used instead.

Platform and Versions

Other Notes/Information

bobbrow commented 3 years ago

Holy cow, how do you get a target name that long? 👀 Can you open a new issue for that? We should be able to swallow the exception.

I'm still kind of stuck without a repro for this issue, so I don't have any more updates right now. I'm thinking about a modification to the Log Diagnostics command that might help determine whether the problem is symlink related though. I just haven't had time to implement it yet.

andreeis commented 3 years ago

@adelejjeh, we released CMake Tools 1.9.1 today with several bug fixes that may address your scenario as well. Upgrade this extension in VSCode and let us know if this is not completely fixed and also if you encounter any other issues.

bobbrow commented 3 years ago

And if it doesn't work, there's a new feature in the Log Diagnostics command that should give us a hint as to whether symlinks are the root cause of the problem. So if IntelliSense continues to configure incorrectly, please run the CMake: Log Diagnostics command and share the output.

github-actions[bot] commented 2 years ago

This issue has been closed automatically because it needs more information and has not had recent activity.