This extension adds some utility to ease the work with C/C++ targets in a bazel workspace and allows to work efficiently with IntelliSense.
Note: Currently only googletest is supported as testing framework.
Having a file from your bazel workspace opened, just enter
vsc-bazel-tools from the command palette (
Generate compile commands the
compile_commands.json file will be generated.
In large repositories you might want to limit the number of targets to generate compile commands for with
refresh_compile_commands bazel target (see bazel-compile-commands-extractor for details). You can reference this via the
Run & debug tests
activateTesting setting is set to true (default), the extension tries to discover
cc_test targets and parses underlying test cases. Just open the test explorer UI and you should find a list of your current tests, similar to this:
Depending on the size of your C++ project, the test discovery process might take a while. You can reduce the search space by the extension setting
testDiscoverLabel. In case of unexpected failures, check the extension output for error logs.
vsc-bazel-tools.customCompileCommandsTarget: Specifies a custom bazel target (label) to generate the compile commands.
vsc-bazel-tools.activateTesting: Discover and publish tests via test explorer UI.
vsc-bazel-tools.testDiscoverLabel: Bazel label for test discovery (e.g.