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

Allow inlining method calls if current inlining is simple #99

Merged
merged 8 commits into from
Dec 6, 2019

Conversation

dansanduleac
Copy link
Contributor

@dansanduleac dansanduleac commented Dec 6, 2019

Before this PR

#63 fixed a degenerate case where SafeArg.of( and other similar X.y( method calls could end up with their parameters on a new line, even if this was just an argument that was part of a long method call with other arguments.

Unfortunately, this fix also broke a bunch of situations that were relying on this inlining logic, and whose code consequently blew up to many many levels of indentation, breaking the 120 character limit.

After this PR

==COMMIT_MSG==
Bring back inlining the prefix of method calls iff the levels inlined so far have all been simple.

By simple, in practice we mean a single method call (rather than chained method calls), or a single method parameter. This is defined as a property on the Level OpenOps created in JavaInputAstVisitor.
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Dec 6, 2019

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Bring back inlining the prefix of method calls iff the levels inlined so far have all been simple. This fixes the regression introduced in 0.3.4 where long nested method calls would end up with too many indents.

Check the box to generate changelog(s)

  • Generate changelog entry

@iamdanfox
Copy link
Contributor

Would kinda like to have the specific test case from fforms that prompted this checked in!

@dansanduleac
Copy link
Contributor Author

dansanduleac commented Dec 6, 2019

🚂

@bulldozer-bot bulldozer-bot bot merged commit 2eab361 into develop Dec 6, 2019
@bulldozer-bot bulldozer-bot bot deleted the ds/better-inline branch December 6, 2019 15:35
@svc-autorelease
Copy link
Collaborator

Released 0.3.5

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

Successfully merging this pull request may close these issues.

3 participants