-
Notifications
You must be signed in to change notification settings - Fork 476
Remove underscore if placeholder is in first position #8033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove underscore if placeholder is in first position #8033
Conversation
c759df6 to
d13942e
Compare
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
d13942e to
65ac40c
Compare
nojaf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, don't forget your changelog entry.
|
@shulhi Thanks! Cann you add a CHANGELOG entry and maybe add a comment to address @nojaf's concern? As for release management, I think this one is fine to go into 12.0.2 (current master) as a fix for weird formatting after migration. |
Fix #8013
This PR improves the formatter's handling of underscore placeholders (_) in pipe expressions by automatically converting them to their canonical form. When a placeholder appears in the first position of a piped function call and it's the only placeholder occurrence, the formatter now omits it since the pipe operator already provides that argument.
Examples:
a->map2(_, fn)→ formats toa->map2(fn)filterNone->Array.get(_, 0)→ formats tofilterNone->Array.get(0)The formatter preserves multiple placeholders when they're semantically meaningful (e.g.,
a->f(_, _, b)remains unchanged).