better support for non-bzl starlark files
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
I'd like to add support for .bara.sky files, which are written in starlark.
#12049 added a filetype for starlark, so it would be easy to detect .bara.sky files as that. However, there was already a filetype for bzl which is also written in starlark, and has much better support in vim (it already has a ftplugin, indent, and syntax file, which starlark doesn't have). Looking through the runtime files for bzl, I only see 1 line that's specific to bzl, as opposed to generic starlark, and even that wouldn't cause any trouble for non-bzl starlark: https://github.com/vim/vim/blob/3cb41489dc8856959c1d586217f141ce057dc373/runtime/syntax/bzl.vim#L15
Describe the solution you'd like
I think it would make sense to rename the runtime files for bzl to starlark, add new files for bzl that source the starlark files, and move the one bzl-specific line back into the bzl file. And also detect foo.bara.sky files as starlark.
Describe alternatives you've considered
- Get rid of starlark in favor of bzl, since bzl is much better supported.
- Move bzl files to starlark and get rid of bzl, since that's technically more correct than the above.
Additional context CC @amaanq from #12049 and @dbarnett from the bzl runtime files.
Thanks, I'd like to hear opinions from othres
Yeah I believe it's all the same language and should just keep the original bzl name (but note bazel BUILD files are still a subset with slightly different indentation conventions). Technically Starlark is used outside of the Bazel project but I don't see any huge advantage to changing or forking the name, as long as standard filenames are detected so people don't keep thinking it needs to be created from scratch.
OTOH if everyone wants to rename it I don't have a strong opinion these days, just seems like "bzl" is a fine name and has more momentum.
The .bara.sky thing is indeed a common name for bizarre historical reasons, and certainly shouldn't conflict with anyone else's conventions if it's mapped to bzl.
I'm fine with that approach, and nobody else has expressed an opinion, so I made #16790 to implement that. I'll make another PR to add support for *.bara.sky afterwards if the first PR is accepted.
Is there really no value in having the two filetypes? The initial proposal seems like the best one at first glance.
We have been trying to avoid unnecessary backward compatibility issues and dropping a filetype seems unnecessary.
There is also some external use of the filetype:
- https://github.com/cappyzawa/starlark.vim
- https://github.com/carvel-dev/ytt.vim
I don't have a strong opinion one way or the other, and I'm happy to make another PR for the initial proposal.
P.S. When I made the PR above I was definitely thinking about https://en.wikipedia.org/wiki/Ward_Cunningham#%22Cunningham's_Law%22
The best way to get the right answer on the Internet is not to ask a question; it's to post the wrong answer.
I figured the best way to move the conversation forward (if there was any more conversation to have) was to just make a PR, not to ask if there was consensus. So I'm glad that worked :)
so let's keep the current solution for now.
My 2 cents as a user: I think @dseomn's proposal makes sense, Starlark is the official name of the language, it's a historical accident that it is called bzl in Vim's codebase. Using starlark as a base and bzl for BUILD-ish files with more specific tweaks to its ftplugins would be good IMO.