intellij
intellij copied to clipboard
IntelliJ Reformat Code action ignores .buildifier.json
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:
- preserving long labels
- re-ordering rule attributes consistently with
-lint fix
, but not consistently with-lint warn
- not fixing out-of-order-load