The intellisense from clangd is much better and faster than the Microsoft C++ extension, if you can set up a compile_commands.json. Although debugging still relies on the Microsoft extension. Although I don't think it's going to be hard to create an extension just for debugging (if it does not already exist?)
Is there a ‘right’ (or simple/direct) way to generate this using various buildchains? I remember setting this up so I could use Sublime with intellisense a while ago, and finding that I could only get it to generate with a specific compiler chain on windows (ninja I think?)
Minor annoyance to have to make my c make project generate buildchain files for a compiler I’m not using & copy that file into my project root to commit it- unrelated to the original question, but also annoying that I have to manually generate it every time I make significant codebase changes.
> and finding that I could only get it to generate with a specific compiler chain on windows (ninja I think?)
Yes, you're right about that.
Basically, it boils down to "use CMake with Ninja/Makefile" (even if you don't strictly have to, you could write a script that creates the json yourself, for example). When cross-compiling, you may also have to whitelist compiler paths.
Add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON as command-line arg during the config step, or add the equivalent "set" call to your CMakeLists.txt, restart clangd (ctrl+p, restart clangd), and you're good to go.
There are minor annoyances when cross-compiling (it using clang -- some compile options are incompatible and need to be removed in global user config, and it not extracting default compiler defines from compilers) but they are very easily worked around
I've had the opposite experience with weird C++ projects from some customers that use external toolchains. For some reason even creating the compile_commands.json file with Bear doesn't work, while the proprietary Intellisense extension works out of the box without any configuration.