bazelbuild / vscode-bazel

Bazel support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=BazelBuild.vscode-bazel
Apache License 2.0
232 stars 76 forks source link

Support running buildifier through Bazel #350

Closed vogelsgesang closed 4 months ago

vogelsgesang commented 4 months ago

Buildifier is frequently installed through Bazel as described on https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#setup-and-usage-via-bazel such that it can be run through bazel run.

This commit allows the bazel.buildifierExecutable setting to refer to a Bazel target. All paths starting with @ are interpreted as Bazel target names and are executed through bazel run. Bazel targets could also start with // but we interpret those as normal file system paths. If someone wants to run a target in the own workspace, they can simply use, e.g., @//:buildifier instead of //:buildifier.

As a drive-by fix, I also fixed #329 since it was a one-line fix.

Fixes #185, #329

BEGIN_COMMIT_OVERRIDE feat: Support running buildifier through Bazel (#350)

feat: Support relative paths for bazel.buildifierExecutable (#350) feat: Pick up .buildifier.json configuration from the Bazel workspace root (#350) END_COMMIT_OVERRIDE

Zemnmez commented 4 months ago

Thank you for this!