typstfmt icon indicating copy to clipboard operation
typstfmt copied to clipboard

[suggestion] Formatting `align` with 1 argument

Open Andrew15-5 opened this issue 1 year ago • 10 comments

I would prefer if typstfmt wouldn't format at least this simple code:

#align(center)[
  something
]

to this:

#align(
  center,
)[
  something
  ]

It's just not efficient (and pretty ugly).

But with long variables (instead of values) with which the line exceeds max_line_length, the current formatting is necessary:

#let asdkfhjaskfdahskfdahsfjhaskjasdhfihweuioiuvnueiniuqiybiuwybfwiefwieuyfdfhasjfhd = center
#align(asdkfhjaskfdahskfdahsfjhaskjasdhfihweuioiuvnueiniuqiybiuwybfwiefwieuyfdfhasjfhd)[
  something
]
#let asdkfhjaskfdahskfdahsfjhaskjasdhfihweuioiuvnueiniuqiybiuwybfwiefwieuyfdfhasjfhd = center
#align(
  asdkfhjaskfdahskfdahsfjhaskjasdhfihweuioiuvnueiniuqiybiuwybfwiefwieuyfdfhasjfhd,
)[
  something
  ]

P.S. Since align mostly used with 1 short argument/value, it's only logical to optimize formatting for it. If there are similar cases with other functions, then some general rule can be applied.

Andrew15-5 avatar Aug 24 '23 23:08 Andrew15-5