vim-autoformat / vim-autoformat

Provide easy code formatting in Vim by integrating existing code formatters.
MIT License
2.25k stars 180 forks source link

no default buildifier defined for bzl files #386

Closed gtianyi closed 1 year ago

gtianyi commented 1 year ago

Could you add the default buildifier for BUILD?

Error detected while processing function <SNR>34_TryAllFormatters:                                                                                                                                                                                                                        
line   35:                                                                                                                                                                                                                                                                                
No format definition found in 'g:formatdef_buildifier'
chtenb commented 1 year ago

What are you trying to do?

gtianyi commented 1 year ago

Thanks @chtenb. Currently, we don't have a default formatdef_buildifier set correctly for BUILD file formatter. Add let g:formatdef_buildifier="'buildifier'" to the init.vim works, but it would be nicer if we can add the default to the plugin source, so it can work out-of-box.

Maybe we can add something like

if !exists('g:formatdef_buildifier')
    let g:formatdef_buildifier="'buildifier'"
endif

at https://github.com/vim-autoformat/vim-autoformat/blob/master/plugin/defaults.vim#L88

I can help raise a PR if needed.

chtenb commented 1 year ago

Yes, you can open a PR if you think others would benefit.

gtianyi commented 1 year ago

Thanks! PR up https://github.com/vim-autoformat/vim-autoformat/pull/392