mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.21k stars 339 forks source link

Please support curly_bracket_next_line as alias of function_next_line in shfmt #930

Closed ale5000-git closed 1 year ago

ale5000-git commented 1 year ago

Hi, curly_bracket_next_line is listed in the official wiki: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#ideas-for-domain-specific-properties and it seems to do the same of function_next_line.

So it would be nice to support it, please.

mvdan commented 1 year ago

See https://github.com/mvdan/sh/issues/721. Currently, the option does not apply to all { tokens, only the function ones. That issue is about changing the option to make it more consistent.

I guess it's then up for debate whether we should make curly_bracket_next_line an alias for the existing editorconfig setting we already have for this shfmt flag. My thinking is probably not, given that with 721 implemented, the flag would also affect do and then, which are clearly not curly brackets. But I could be convinced otherwise. Perhaps leave a comment there and see what others think.

Closing this for now in favor of 721. I definitely don't think we should change the existing function_next_line given how we want to replace it.