syntax icon indicating copy to clipboard operation
syntax copied to clipboard

A line comment between function arguments breaks indentation when wrapped in another function

Open TomiS opened this issue 4 years ago • 4 comments

Like this

@react.component
let make = React.forwardRef((~id: option<string>=?,
~className: option<string>=?,
// Remove me to fix the problem
~children: option<React.element>=?,
forwardedRef) => {
  <div />
})

Try it out here https://rescript-lang.org/try?code=AIJwpghgxgLgdFA9gWwA6IHZgzAUAGzBgAJkIBrMYgXmICVJY4AzREAdwhABMHmAKfgD8AltwBcxRKhgjMAHgDOMECIwBzAHzUA-ABpcQqPgiLFAOQjIwk6bIXLVG7ftwB6N-TDJEANyrWxDCIxMwiAB5BABZUqCCIAEaEyIZQUSL43OAYtjJyGPIM0PBgydgwLgasHFzcYLxgzACUNJrEAN64xMTy3CK+xG6auAC+TbhAA

TomiS avatar Jan 07 '21 11:01 TomiS

Thanks for the report, I'll look into this.

IwanKaramazow avatar Jan 14 '21 05:01 IwanKaramazow

Another related case:

React.useEffect5(() => {
  doThings()
  None
}, // intentionally only running on mount (make sure it's only mounted once :))
(
  context.activate,
  context.chainId,
  dispatch,
  setTriedLoginAlready,
  triedLoginAlready,
))

IwanKaramazow avatar Jan 14 '21 06:01 IwanKaramazow

Not sure if related, but this is also a funny one (annotation breaks comment):

@someAnnotation
module // I dare you to move this comment above the module definition (but after the annotation)
MyModule = {}

playground link

TomiS avatar Jan 21 '21 16:01 TomiS

@TomiS Yes, unfortunately due to lack of time this hasn't been implemented yet. For now it's always

// comment
@attribute
module Bar = {}

IwanKaramazow avatar Jan 24 '21 06:01 IwanKaramazow

The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.

stale[bot] avatar May 28 '23 19:05 stale[bot]