buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

feat: autodetect buck2 file names

Open lf- opened this issue 5 months ago • 3 comments

This interprets BXL files as bzl, which they basically are. It also interprets BUCK files as BUILD, which they also are.

Ref: https://buck2.build/docs/bxl/

lf- avatar Jul 17 '25 20:07 lf-

I dunno how to write a meaningful test for this change.

lf- avatar Jul 17 '25 20:07 lf-

There is an existing test in lex_test.go, please just add the new filenames there.

Please also add non-trivial combinations such as buck.bzl or BUILD.bxl (which should resolve to TypeBzl).

vladmos avatar Jul 21 '25 10:07 vladmos

Do you want to fix the formatting or the warnings? This change will cause all Bazel-specific warnings (that are normally applied only to BUILD/.bzl files) to be applied to the Buck files as well.

If you only want to fix the formatting, then you don't need to do anything to bxl files (all unknown files are formatted as bzl), and create another filetype for BUCK files (maybe call it TypeDefaultBuild instead of TypeBuck as it's not BUCK-specific but only suggests that the file should be formatted using BUILD file rules).

vladmos avatar Jul 21 '25 10:07 vladmos