Skip to content

Conversation

@shulhi
Copy link
Member

@shulhi shulhi commented Oct 25, 2025

Fix #7961

The formatting of the transformed JSX forces multiline for props with this change. However, I think this is fine because users won't actually see the transformed JSX anyways.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 25, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7993

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7993

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7993

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7993

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7993

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7993

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7993

commit: 57aa27b

@shulhi shulhi marked this pull request as ready for review October 26, 2025 11:47
Copy link
Member

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we first reach consensus with the core contributors before merging?

This sets a precedent, and I think we should have a broader discussion about the direction we want to take.

For context, see my earlier thoughts here: #7961 (comment)

* }` -> record is written on multiple lines, break the group *)
let force_break =
e.pexp_loc.loc_start.pos_lnum < e.pexp_loc.loc_end.pos_lnum
match (spread_expr, rows) with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to pause here a bit — I don’t think we should merge this part right now.

The change around force_break introduces behaviour that depends on how the user originally formatted their code. That’s a significant precedent: it ties output formatting decisions to source‑layout heuristics.

If we want to allow this kind of stylistic inference, I believe it needs wider agreement within the core team. We should either decide as a group that this is a direction we’re comfortable with, or explicitly document why we don’t want to go that way.

If we do agree in principle, I’d also like to see a short architectural or design record capturing the rationale and boundaries for this sort of logic, so that future contributions have something concrete to refer to.

Finally, even with buy‑in, I’d suggest postponing this until after v12. We’re in the release‑candidate stage, and introducing new formatting heuristics at this point could have more ripple effects than we realise.

So in short: let’s not merge this specific part yet; let’s first get consensus and document it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent multiline printing of record types and values

2 participants