sorawee / fmt

A code formatter for Racket
Other
72 stars 6 forks source link

Better support for define/contract #46

Open sorawee opened 1 year ago

sorawee commented 1 year ago

See also https://github.com/sorawee/fmt/issues/34#issuecomment-1576805396 by @jessealama

(define/contract x integer? 1)

should be formatted that way, not

(define/contract x 
  integer? 
  1)

Also, we probably should support

(define/contract (f x) (-> integer? integer?) 
  (+ x 1))

The problem is that with our current pretty printer, this style will almost always be preferred over

(define/contract (f x) 
  (-> integer? integer?) 
  (+ x 1))

even though the first line is really long. Our new pretty printer can fix this problem, but let's wait for now.