bazel-contrib/vscode-bazel

Add `bazel.info.*` commands

jfirebaugh opened this issue · 1 comments

I propose adding a set of commands to the plugin: bazel.info.bazel-bin, bazel.info.bazel-genfiles, and so on, for all or some subset of the bazel info keys. Each command would do nothing but output the value of the corresponding key.

Here's why this would be useful: command variables. Using these commands, one could define launch configurations in a way that does not hard-code architecture-specific or workspace-specific details. For example instead of writing

  "program": "${workspaceFolder}/bazel-out/darwin-dbg/bin/example",

as in this widely-cited post, you could write:

  "program": "${command:bazel.info.bazel-bin}/example",

The latter will work on Apple Silicon and workspaces that use --experimental_convenience_symlinks=clean.

If there's support for this feature, I can supply a PR.

The bazel.info.* approach to launch configurations turns out not to generalize widely enough, but I think this will: #275.