bazel-contrib / bazel-contrib/vscode-bazel

make buildifier warning less aggressive

Open
#402 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
296
Forks
108
Avg merge
3d 22h
Merged PRs (30d)
5

Description

This extension's warning about no `buildifier` being found is overly eager, and presumes that the environment should have a single, global `buildifier` executable shared by multiple projects.

But developers often prefer to have project-local versions of their tool dependencies (and no global version) for better reproducibility, which is even facilitated for `buildifier` by https://github.com/keith/buildifier-prebuilt. Note that all projects created via `aspect init` use this setup (see https://github.com/aspect-build/aspect-workflows-template).

Such users can add something like the following to ensure that a `buildifier` binary is available when their projects are opened and that the Bazel extension is configured to use it:
.vscode/tasks.json:
```json
{
// Build `buildifier` on folderOpen to ensure that a buildifier binary exists which the
// VSCode Bazel plugin can use.
"label": "Build buildifier",
"command": "bazel build @buildifier_prebuilt//:buildifier",
"presentation": {
"reveal": "never",
"panel": "new"
},
"runOptions": {
"runOn": "folderOpen",
},
"type": "shell",
}
```
.vscode/settings.json:
```json
{
"bazel.buildifierExecutable": "bazel-bin/external/buildifier_prebuilt~/buildifier/buildifier",
}
```
But even with this configuration, this extension still nags about no `buildifier` being found, because the check for it completes a split second before it's finished building, and it's never checked for again.

If the initial check fails, how about doing a retry or two with a sensible backoff?

cc @alexeagle

Contributor guide

Open the contributing guide

Research direction

Start by tracing the extension's buildifier availability check and how it uses the bazel.buildifierExecutable setting. Reproduce the project-local setup from .vscode/tasks.json and .vscode/settings.json, then verify that a delayed buildifier becomes available without leaving the warning visible; the issue names no source file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.