ormolu icon indicating copy to clipboard operation
ormolu copied to clipboard

Awkward placement of comment on field of data type

Open mitchellwrosen opened this issue 2 years ago • 1 comments

Describe the bug ormolu (version 0.1.4.0) can relocate an inline comment on the field of a data type to an awkward spot

To Reproduce Run ormolu on the following file

data Foo
  = Foo Bar {- the bar -} (Baz (Qux Womp)) {- the baz -}

Expected behavior No change to formatting

Actual behavior

data Foo
  = Foo Bar {- the bar -} (Baz (Qux Womp {- the baz -}))

mitchellwrosen avatar Sep 02 '21 20:09 mitchellwrosen

In case it wasn't totally clear, the original comment is clearly trying to document the entire Baz field:

(Baz (Qux Womp)) {- the baz -}

whereas after formatting, it gets pushed into Baz's argument:

(Bax (Qux Womp {- the baz -}))

mitchellwrosen avatar Sep 15 '21 15:09 mitchellwrosen