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

Methods and objects with numerous arguments Style #1482

Closed
JhLedesma opened this issue Aug 19, 2019 · 1 comment · Fixed by #1725
Closed

Methods and objects with numerous arguments Style #1482

JhLedesma opened this issue Aug 19, 2019 · 1 comment · Fixed by #1725

Comments

@JhLedesma
Copy link

JhLedesma commented Aug 19, 2019

This template is a guideline, not a strict requirement.

  • Version: 2.0.1
  • Integration: IntelliJ
  • Configuration:
maxColumn = 160
align = some
align = more
align.tokens = [{code = "=>", owner = "Case"}]
align.tokens = [
{code = "%", owner = "Term.ApplyInfix"},
{code = "%%", owner = "Term.ApplyInfix"}
]
align.arrowEnumeratorGenerator = true
align.openParenCallSite = true
align.openParenDefnSite = false
newlines.alwaysBeforeTopLevelStatements = true
rewrite.rules = [AvoidInfix]
includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = true

Steps

Given code like this:

surveyStageHandlerResult(actionRequest, client,
          List(newCustomInputAction(PhoneNotificationSurveySecondQuestionAudioName))

When I run scalafmt like this:
Save in IntelliJ.

Problem

Scalafmt formats code like this:

surveyStageHandlerResult(
          actionRequest,
          client,
          List(newCustomInputAction(PhoneNotificationSurveySecondQuestionAudioName))
)

Expectation

I would like the formatted output to look like this ():

surveyStageHandlerResult(
         actionRequest,
         client,
         List(newCustomInputAction(PhoneNotificationSurveySecondQuestionAudioName)))

Workaround

Notes

https://docs.scala-lang.org/style/indentation.html#methods-with-numerous-arguments

@poslegm
Copy link
Collaborator

poslegm commented Nov 9, 2019

@JhLedesma you can just add danglingParentheses = false into your .scalafmt.conf.

We should document this important option on the website.

kitbellew added a commit to kitbellew/scalafmt that referenced this issue Feb 19, 2020
kitbellew added a commit to kitbellew/scalafmt that referenced this issue Feb 19, 2020
kitbellew added a commit to kitbellew/scalafmt that referenced this issue Feb 19, 2020
kitbellew added a commit that referenced this issue Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants