Skip to content

Commit e76afe8

Browse files
fix(buildifier): formatting of BUILD file (#594)
When editing a file named BUILD, the command `buildifier` was executed, but the file in the editor was not reformatted properly. If I'd run `buildifier [path-to-file]`, the file would be reformatted as expected, so the formatter works as expected in this case. After experimenting a bit, I came up with the new command line I propose in this change. It still sends the code via stdin to `buildifier`, but now is aware of the path the file has in the project. This seems to have an influence on the behavior of `buildifier`. See `buildifier --help`: ``` -type string Input file type: build (for BUILD files), bzl (for .bzl files), workspace (for WORKSPACE files), default (for generic Starlark files) or auto (default, based on the filename) (default "auto") ```
1 parent 02fd64f commit e76afe8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lua/conform/formatters/buildifier.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ return {
55
description = "buildifier is a tool for formatting bazel BUILD and .bzl files with a standard convention.",
66
},
77
command = "buildifier",
8+
args = { "-path", "$FILENAME", "-" },
89
}

0 commit comments

Comments
 (0)