|  | 
| 1 |  | -The built-in buildifier formatter knows how to format Bazel BUILD files. If you | 
| 2 |  | -aren't familiar with basic codefmt usage yet, see main.vroom first. | 
|  | 1 | +The built-in buildifier formatter knows how to format Bazel BUILD and .bzl | 
|  | 2 | +files. If you aren't familiar with basic codefmt usage yet, see main.vroom | 
|  | 3 | +first. | 
| 3 | 4 | 
 | 
| 4 | 5 | We'll set up codefmt and configure the vroom environment, then jump into some | 
| 5 | 6 | examples. | 
| @@ -38,14 +39,17 @@ buildifier_executable flag if the default of "buildifier" doesn't work. | 
| 38 | 39 |  $ ) | 
| 39 | 40 |  :Glaive codefmt buildifier_executable='buildifier' | 
| 40 | 41 | 
 | 
| 41 |  | -The bzl filetype will use the buildifier formatter by default. | 
|  | 42 | +The bzl filetype will use the buildifier formatter by default. The path to the | 
|  | 43 | +file being edited is passed to buildifier so that it can adjust to whether the | 
|  | 44 | +file is a BUILD or .bzl file. | 
| 42 | 45 | 
 | 
| 43 | 46 |  @clear | 
| 44 | 47 |  % foo_library(name = "foo", srcs = ["bar.js"],) | 
| 45 | 48 | 
 | 
|  | 49 | + :silent file /foo/bar/BUILD | 
| 46 | 50 |  :set filetype=bzl | 
| 47 | 51 |  :FormatCode | 
| 48 |  | - ! buildifier .* | 
|  | 52 | + ! buildifier -path /foo/bar/BUILD .* | 
| 49 | 53 |  $ foo_library( | 
| 50 | 54 |  $ name = "foo", | 
| 51 | 55 |  $ srcs = ["bar.js"], | 
|  | 
0 commit comments