syntax
syntax copied to clipboard
A line comment between function arguments breaks indentation when wrapped in another function
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
Thanks for the report, I'll look into this.
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,
))
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 = {}
@TomiS Yes, unfortunately due to lack of time this hasn't been implemented yet. For now it's always
// comment
@attribute
module Bar = {}
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.