C/C++ support in VSCode

Hi,
Instead of waiting for a new feature in the VSCode Cpptools extension, what about using the compilation database available in file compile_commands.json ?
It’s a single file, and its format is specified in the Clang documentation.
But Clang is NOT required, as it can be generated by many build systems :

  • If you are using CMake, you add command CMAKE_EXPORT_COMPILE_COMMANDS in your CMakeLists.txt
  • If you are using Make, tools like compiledb can generate it from your makefiles. There is also Bear but I did not try it.
  • (to be completed)

Nowadays, the compile_commands.json compilation database is supported by most C++ IDEs.
Even Microsoft Visual Studio Code C/C++ extension tries to detect the file compile_commands.json, then uses it to improve search performance.

If SonarLite relies on the compile_commands.json compilation database to collect the compilation properties (compiler flags/arguments/includes locations), then it will be able to run indepently in many environments.
Not only VSCode.

The work should be small, as the compile_commands.json is a single JSON file.

Here is a related request, but for sonar scanner :
CPP-1428 : Add support for JSON compilation database
C++ and cmake: Running sonar scanner on compile_commands.json