Open Xophmeister opened 1 year ago
I think the industry standard is Buildifier
As @ErinvanderVeen points out Buildifier is the standard formatter used for Bazel Starlark files. Next to formatting it also provides linting. For those who like pre-commit checks, there is also an integration. There is also Meta's Starlark-Rust which includes linting capabilities and a language server and VSCode extension.
Is your feature request related to a problem? Please describe. We're often on the look-out for new languages to add support for, in Topiary. Starlark may be worth looking into, given our connection with the Scalable Builds Group.
Describe the solution you'd like Starlark formatting support in Topiary.
Describe alternatives you've considered I didn't immediately find any extant Starlark formatters (to be fair, I didn't look very hard). As Starlark is (IIRC) a subset of Python, it may be possible to format it with Python formatters, such as Black; I don't know if this is the usual approach. (@aherrmann Do you know the formatting story for Starlark?)
(If, e.g., Black is a viable formatter for Starlark, then that would deprioritise this issue.)
Additional context There are at least two Tree Sitter grammars for Starlark:
If we're going to support Python in the future, then supporting Starlark may be a good intermediary step.
(It's a big "if", which also applies to Starlark: It's not 100% clear that Topiary will work well with semantic-whitespace languages.)