bazel-contrib / bazel-contrib/vscode-bazel

Prebuilt Buildifier Not Working As Expected

Open
#427 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
TypeScript
Stars
296
Forks
108
Avg merge
3d 22h
Merged PRs (30d)
5

Description

I'm hitting into some problems when trying to get prebuilt Buildifier (via bazel) working with the vscode extension. I am using the latest version of Prebuilt Buildifier ([7.3.1](https://github.com/keith/buildifier-prebuilt/releases/tag/7.3.1)).

## Bazel Setup

```
# Workspace
http_archive(
name = "buildifier_prebuilt",
sha256 = "7f85b688a4b558e2d9099340cfb510ba7179f829454fba842370bccffb67d6cc",
strip_prefix = "buildifier-prebuilt-7.3.1",
urls = [
"http://github.com/keith/buildifier-prebuilt/archive/7.3.1.tar.gz",
],
)

load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()
```

```
./BUILD.bazel
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier",
)
```

## Vscode Setup:
```
{
"bazel.buildifierExecutable": "@buildifier_prebuilt//:buildifier"
# @//:buildifier also doesnt appear to work
"bazel.lsp.command": "starpls"
}
```

Running buildifier directly from bazel works as expected however I don't seem to be able to get linting highlighting to show up. Might anyone know what I'm doing wrong?

Contributor guide

Open the contributing guide

Research direction

Start with the BUILD.bazel rule and the bazel.buildifierExecutable and bazel.lsp.command settings, comparing the working direct Bazel invocation with how the VS Code extension invokes it. Done means the prebuilt Buildifier setup works through the extension and linting highlighting appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.