When I use Zig to build a C++ project, I want better code hints in my editor. For CMake-based projects, I can generate a compile_commands.json file by adding the following code to the build configuration:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
I would like to know if Zig provides a similar mechanism.
I have very recently started looking at C++, so I’m still deeply unfamiliar with the ecosystem, but I use the Zig build system for my experimentation repo. I have a config.zig file, as a single source of truth for everything, and then my build.zig pulls that in and creates or updates .clang-tidy and compile_flags.txt for me. I don’t know the compile_commands.json format, so maybe that requires a lot more machinery or something, but perhaps looking at my example helps.