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

Attempt to break long expressions into multiple lines #5207

Merged
merged 12 commits into from
Oct 28, 2023

Conversation

cr-fuel
Copy link
Contributor

@cr-fuel cr-fuel commented Oct 19, 2023

Fixes #3474

Description

Breaks long expressions (focusing into chained methods calls but will cover all expressions) into multiple lines

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@cr-fuel cr-fuel self-assigned this Oct 19, 2023
@cr-fuel cr-fuel force-pushed the chained-methods-long-expr branch 2 times, most recently from ee2d2cc to 1bd6bf7 Compare October 20, 2023 06:11
@cr-fuel cr-fuel requested a review from a team October 20, 2023 22:53
@cr-fuel cr-fuel marked this pull request as ready for review October 20, 2023 22:54
@cr-fuel cr-fuel changed the title WIP: Attempt to break long expressions into multiple lines Attempt to break long expressions into multiple lines Oct 20, 2023
Copy link
Contributor

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

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

Nice one @cr-fuel !

Left one small nit, but feel free to ignore.

swayfmt/tests/mod.rs Show resolved Hide resolved
Copy link
Contributor

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

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

Looks like there are some failing checks.

The format check is failing because the changes you've introduced have not been applied to the examples directory. Also looks like there may be some compiler warnings causing the clippy check to fail.

@eureka-cpu eureka-cpu requested a review from a team October 20, 2023 23:06
@eureka-cpu eureka-cpu added enhancement New feature or request formatter labels Oct 20, 2023
@eureka-cpu eureka-cpu added this to the swayfmt milestone Oct 20, 2023
examples/identity/src/main.sw Outdated Show resolved Hide resolved
examples/vec/src/main.sw Outdated Show resolved Hide resolved
@cr-fuel cr-fuel requested review from eureka-cpu and a team October 23, 2023 04:45
@cr-fuel cr-fuel enabled auto-merge (squash) October 23, 2023 04:45
examples/vec/src/main.sw Outdated Show resolved Hide resolved
@JoshuaBatty JoshuaBatty requested a review from a team October 24, 2023 04:54
@cr-fuel cr-fuel force-pushed the chained-methods-long-expr branch 2 times, most recently from 652ad3c to 26eee76 Compare October 24, 2023 13:57
@cr-fuel cr-fuel requested review from JoshuaBatty and a team October 26, 2023 19:09
@JoshuaBatty JoshuaBatty requested a review from a team October 27, 2023 03:06
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

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

Nice work!

@cr-fuel cr-fuel dismissed eureka-cpu’s stale review October 28, 2023 01:12

It was approved already

@cr-fuel cr-fuel merged commit d9de68d into master Oct 28, 2023
32 checks passed
@cr-fuel cr-fuel deleted the chained-methods-long-expr branch October 28, 2023 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chained methods & fields that should be multiline need logic to handle vertical formatting
4 participants