microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Make the extension look for the compiler in the PATH environment variable as well #12779

Open luizfernandonb opened 1 month ago

luizfernandonb commented 1 month ago

Feature Request

Currently we have to put the full path of the compiler in the compilerPath property in c_cpp_properties.json, and this breaks portability between systems, since the paths between Windows and Linux are different, would it be possible to put only the name of the compiler and the extension to search for the executable in the PATH environment variable?

Example: "compilerPath": "C:/Program Files/Clang/bin/clang.exe" -> "compilerPath": "clang"

Colengms commented 1 month ago

Hi @luizfernandonb . I'm going to consider this a bug. I believe this did work at one time and may have regressed.

luizfernandonb commented 1 month ago

@Colengms

Just to add, the same goes for clang-tidy, it's on my path image

However, the extension downloaded a version and uses it instead of the one in the PATH image

And I didn't fill anything in the extension settings image

sean-mcmanus commented 1 month ago

I believe the clang-tidy/format issue is tracked by https://github.com/microsoft/vscode-cpptools/issues/12718 (it currently doesn't use the environment version if it's older, which was due to many users having an old version on their machine that causes stuff to not work).