Closed annappropriate closed 7 years ago
Thank you for reporting! This is a known issue and is unlikely to change without a redesign such as proposed in #917
Forgot to link to the "Known issues" section in the docs with possible workarounds http://scalameta.org/scalafmt/#Deeplynestedcode
Olafur, as of 1.5.1, how to deal with the very same issue?
Contents of
test.scala
:(some json4s mess...)
scalafmt --debug test.scala
``` Working directory: /tmp Formatting files: List(FileContents(/tmp/test.scala)) Configuration: maxColumn = 80 onTestFailure = project.git = false project.files = [] project.includeFilters = [".*\.scala$" ".*\.sbt$"] project.excludeFilters = [] align.openParenCallSite = true align.openParenDefnSite = true align.ifWhileOpenParen = true align.treeCategory.Defn.Trait = class/object/trait align.treeCategory.Enumerator.Val = for align.treeCategory.Defn.Class = class/object/trait align.treeCategory.Defn.Object = class/object/trait align.treeCategory.Defn.Val = val/var/def align.treeCategory.Defn.Def = val/var/def align.treeCategory.Defn.Var = val/var/def align.treeCategory.Enumerator.Generator = for align.arrowEnumeratorGenerator = false align.tokens = [] continuationIndent.callSite = 2 continuationIndent.defnSite = 4 continuationIndent.extendSite = 4 optIn.configStyleArguments = true optIn.breakChainOnFirstMethodDot = true optIn.annotationNewlines = false assumeStandardLibraryStripMargin = false runner.optimizer.maxEscapes = 16 runner.optimizer.dequeueOnNewStatements = true runner.optimizer.maxVisitsPerToken = 513 runner.optimizer.acceptOptimalAtHints = true runner.optimizer.maxDepth = 100 runner.optimizer.forceConfigStyleMinArgCount = 2 runner.optimizer.disableOptimizationsInsideSensitiveAreas = true runner.optimizer.forceConfigStyleOnOffset = 150 runner.optimizer.recurseOnBlocks = true runner.optimizer.escapeInPathologicalCases = true runner.optimizer.pruneSlowStates = true runner.eventCallback = org.scalafmt.config.ScalafmtRunner$$$Lambda$17/1613255205@17c1bced runner.parser = scala.meta.internal.parsers.ScalametaParser$$anon$202@2d9d4f9d runner.debug = false runner.fatalWarnings = false runner.maxStateVisits = 1000000 runner.ignoreWarnings = false runner.dialect = Scala211 encoding = UTF-8 newlines.afterImplicitKWInVerticalMultiline = false newlines.neverInResultType = false newlines.sometimesBeforeColonInMethodReturnType = true newlines.alwaysBeforeTopLevelStatements = false newlines.afterCurlyLambda = never newlines.penalizeSingleSelectMultiArgList = true newlines.neverBeforeJsNative = false newlines.alwaysBeforeCurlyBraceLambdaParams = false newlines.beforeImplicitKWInVerticalMultiline = false version = 1.0.0-RC1 unindentTopLevelOperators = false poorMansTrailingCommasInConfigStyle = false indentOperator.include = ".*" indentOperator.exclude = "^(&&|\|\|)$" docstrings = ScalaDoc lineEndings = unix rewrite.rules = [] rewrite.redundantBraces.includeUnitMethods = true rewrite.redundantBraces.maxLines = 100 rewrite.redundantBraces.stringInterpolation = false rewrite.neverInfix.includeFilters = ["[\w\d_]+"] rewrite.neverInfix.excludeFilters = [until to by eq ne should.* contain.* must.* in be taggedAs thrownBy synchronized have when] danglingParentheses = false includeCurlyBraceInSelectChains = true binPack.literalsInclude = [".*"] binPack.literalsExclude = [String Term.Name] binPack.literalsMinArgCount = 5 binPack.unsafeCallSite = false binPack.unsafeDefnSite = false binPack.literalArgumentLists = true binPack.parentConstructors = false indentYieldKeyword = true importSelectors = noBinPack verticalMultilineAtDefinitionSite = false spaces.neverAroundInfixTypes = [] spaces.beforeContextBoundColon = false spaces.afterTripleEquals = false spaces.inImportCurlyBraces = false spaces.inParentheses = false [warn] Error in /tmp/test.scala: org.scalafmt.Error$SearchStateExploded: Search state exploded around line 2 ```