Skip to content
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

📝 Chained function are forced on new line when there is an operation as parameter #4618

Closed
1 task done
oom- opened this issue Nov 23, 2024 · 2 comments
Closed
1 task done
Labels
S-Needs triage Status: this issue needs to be triaged

Comments

@oom-
Copy link

oom- commented Nov 23, 2024

Environment information

See playground link

Configuration

See playground link

Issue

When there is an operation in the parameter of the chained function, it's forced back to the beginning of the line instead of keeping it on the same line.

I think this issue could be related: #1039

image
image

Playground links

With a - 60 operation:
https://biomejs.dev/playground/?lineWidth=120&indentStyle=space&trailingCommas=none&code=YwBvAG4AcwB0ACAAZQB4AHAAaQByAGEAdABpAG8AbgBEAGEAdABlACAAPQAgAGQAYQB5AGoAcwAoACkALgBhAGQAZAAoAHIAZQBzAHAAbwBuAHMAZQAuAGUAeABwAGkAcgBlAHMAXwBpAG4AIAAtACAANgAwACwAIAAiAHMAZQBjAG8AbgBkACIAKQAuAHUAbgBpAHgAKAApADsA

Without a - 60 operation:
https://biomejs.dev/playground/?lineWidth=120&indentStyle=space&trailingCommas=none&code=YwBvAG4AcwB0ACAAZQB4AHAAaQByAGEAdABpAG8AbgBEAGEAdABlACAAPQAgAGQAYQB5AGoAcwAoACkALgBhAGQAZAAoAHIAZQBzAHAAbwBuAHMAZQAuAGUAeABwAGkAcgBlAHMAXwBpAG4ALAAgACIAaQB0ACcAcwAgAG4AbwB0ACAAcAByAGkAbgB0AHcAaQBkAHQAaAAiACkALgB1AG4AaQB4ACgAKQA7AA%3D%3D

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@oom- oom- added the S-Needs triage Status: this issue needs to be triaged label Nov 23, 2024
@oom- oom- changed the title 📝 <TITLE> 📝 Chained function are forced on new line when there is an operation as parameter Nov 23, 2024
@arendjr
Copy link
Contributor

arendjr commented Nov 23, 2024

In the playground links, you can see that Prettier's behavior is the same, so it looks to me like this is by design. If I'm not mistaken, the rationale is that there shouldn't be too much information on a single line.

@arendjr arendjr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2024
@ematipico
Copy link
Member

There are different heuristics inside a "member chain". One of them checks where the chain contains complex expressions, and if so, the whole chain goes on multiple lines regardless of the line width.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs triage Status: this issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants