rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

doc comment forces multiline exceptions

Open tx46 opened this issue 2 months ago • 5 comments

  1. type exception Foo({name: string, msg: string}) and run formatter
  2. notice still single line
  3. add doc comment:
/** foo */
exception Foo({name: string, msg: string})

and run formatter 4. notice how formatter forces multiline:

/** foo */
exception Foo({
  name: string,
  msg: string,
})

see also #7946

tx46 avatar Oct 11 '25 12:10 tx46

Just a side note - I don't think we can call these formatter things bugs. It's a formatter behavior that's intentional. You can agree or disagree of course, and there might be good reason to change it, but it's not a bug per se.

zth avatar Oct 13 '25 06:10 zth

Just a side note - I don't think we can call these formatter things bugs. It's a formatter behavior that's intentional. You can agree or disagree of course, and there might be good reason to change it, but it's not a bug per se.

thanks. it's unexpected behavior and there's no way for me to know if it's intentional. would you like me to not open issues on these oddities? or if you want me to, what do you want me to call them?

also if this is indeed intentional, feel free to close this. :)

tx46 avatar Oct 13 '25 07:10 tx46

You don't need to mark them at all, we can do that as we process it. Just describe what you've found and what you expected, and we can label it appropriately from there.

zth avatar Oct 13 '25 07:10 zth

Is this also the case with type (records, inline in variant)?

nojaf avatar Oct 20 '25 09:10 nojaf

Is this also the case with type (records, inline in variant)?

no, just exception

tx46 avatar Oct 20 '25 11:10 tx46