Skip to content

AlignArguments when first argument is a literal number #282

@udalrich

Description

@udalrich

With alignParameters as false, my code formats as

            Importance(10000,
            goal,
                strategy1, strategy2, strategy3, strategy4,
                decCommodityInd, decMoodInd,
                decCurLeaderOpinionInd, incAltLeaderOpinionInd)

With alignParameters as true, it formats as

            Importance(10000,
            goal,
            strategy1, strategy2, strategy3, strategy4,
            decCommodityInd, decMoodInd,
            decCurLeaderOpinionInd, incAltLeaderOpinionInd)

If I replace the constant with a variable, it behaves reasonably.

           // true
            val numIter = 10000
            Importance(numIter,
                       goal,
                       strategy1, strategy2, strategy3, strategy4,
                       decCommodityInd, decMoodInd,
                       decCurLeaderOpinionInd, incAltLeaderOpinionInd)
           // false
            val numIter = 10000
            Importance(numIter,
                goal,
                strategy1, strategy2, strategy3, strategy4,
                decCommodityInd, decMoodInd,
                decCurLeaderOpinionInd, incAltLeaderOpinionInd)

My configuration (through sbt) is

import scalariform.formatter.preferences._

ThisBuild / scalariformPreferences := scalariformPreferences.value.
    setPreference(AlignArguments, true).
    setPreference(AlignParameters, true).
    setPreference(DoubleIndentConstructorArguments, true).
    setPreference(DoubleIndentMethodDeclaration, true).
    setPreference(FirstArgumentOnNewline, Prevent).
    setPreference(IndentLocalDefs, true).
    setPreference(IndentSpaces, 4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions