bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
757 stars 298 forks source link

IntelliJ Reformat Code action ignores .buildifier.json #6424

Open nickbreen opened 2 months ago

nickbreen commented 2 months ago

Description of the bug:

When formatting a BUILD file with Ctrl+Alt+L or invoking "Reformat Code" the file is formatted ignoring the .buildifier.sjon file in the project root.

This is inconsistent with invoking buildifier -lint fix on the command line.

Which category does this issue belong to?

Intellij

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Craft a BUILD file with a fully qualified label:

java_library(
   name = "foo",
   deps = [
       "//bar:bar",
   ],
)

Define .buildifier.json with:

{
  "buildifier_disable": ["label"]
}

Execute buildifier:

buildifier -lint fix BUILD

This honours the configuration and does not shorten the //bar:bar label.

Apply IntelliJ's Format Code action with Ctrl+Alt+L and notice that the label is shortened to //bar.

Which Intellij IDE are you using? Please provide the specific version.

Build #IU-241.15989.150, built on April 29, 2024

What programming languages and tools are you using? Please provide specific versions.

Not relevant

What Bazel plugin version are you using?

2024.04.09.0.1-api-version-241

Have you found anything relevant by searching the web?

Issue https://github.com/bazelbuild/intellij/issues/6157 appears to address a similar problem but is apparently resolved.

Any other information, logs, or outputs that you want to share?

Enabling "Automatically format BUILD/Starlark files on file save" appears to honour some of the configuration.

Format-on-save is: