prettier-plugin-coffeescript icon indicating copy to clipboard operation
prettier-plugin-coffeescript copied to clipboard

Formatting: respect break of try finally clause?

Open helixbass opened this issue 6 years ago • 0 comments

Adding respectBreak: 'control' support for try/catch (#58/#78), but currently isn't checking/respecting whether a single-expression finally block is indented or not, eg this:

try yes finally
  'nothing'

is formatting like

try yes finally 'nothing'

Not sure if we'd want to be able to separately respect break of try/catch/finally? Eg preserve formatting of above rather than generating

try
  yes
finally
  'nothing'

Would that imply a separate group for the finally clause?

And in terms of detecting/implementing, seems like you could either try and compare last line of catch (if it exists) or try to first line of finally block, or perhaps if that wasn't good enough would want to expose indented in the AST similar to how function bodies do?

helixbass avatar Mar 31 '19 17:03 helixbass