Make compile_commands.json work for vscode

Use hedron_compile_commands to generate compile_commands.json

Change-Id: I764c4eb7b2f69cf2b233374947275d3f2452d5d9
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/BUILD b/BUILD
index eea9edb..b38e376 100644
--- a/BUILD
+++ b/BUILD
@@ -2,6 +2,7 @@
 load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
 load("@npm//:defs.bzl", "npm_link_all_packages")
 load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")
+load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
 
 # Link npm packages
 npm_link_all_packages(name = "node_modules")
@@ -80,3 +81,19 @@
     name = "gazelle",
     visibility = ["//tools/lint:__subpackages__"],
 )
+
+refresh_compile_commands(
+    name = "refresh_compile_commands",
+
+    # Specify the targets of interest.
+    # For example, specify a dict of targets and any flags required to build.
+    targets = {
+        "//aos/...": "-c opt",
+        "//frc971/...": "-c opt",
+    },
+    # No need to add flags already in .bazelrc. They're automatically picked up.
+    # If you don't need flags, a list of targets is also okay, as is a single target string.
+    # Wildcard patterns, like //... for everything, *are* allowed here, just like a build.
+    # As are additional targets (+) and subtractions (-), like in bazel query https://docs.bazel.build/versions/main/query.html#expressions
+    # And if you're working on a header-only library, specify a test or binary target that compiles it.
+)