astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

if then else on one line #91

Open ondohotola opened 1 year ago

ondohotola commented 1 year ago

Hi, if I do something like

if row in (0, 1) {
      myred 
   } 
   else if calc.odd(row) { myblue } 
   else { none },

tysptfmt makes something like

if row in (0, 1) { myred } else if calc.odd(row) { myblue } else { none },

out of it, ie puts it into a single (long) line, which I find difficult to read

astrale-sharp commented 1 year ago

EDITED: you were right, i forgot to add # when copying your snippet for testing

It should be like this or like this

if row in (0, 1) { myred } else if calc.odd(row) {
  myblue
} else { none },
if row in (0, 1) { myred } else if calc.odd(row) {
  myblue 
} else { 
  none 
},