sbt/sbt-scalariform

requirement failed: cannot do 'before' formatting for NEWLINE* tokens

ruippeixotog opened this issue · 2 comments

When trying to use scalariform with one of my projects, it fails with the following error:

requirement failed:  cannot do 'before' formatting for NEWLINE* tokens: Token(NEWLINE,
,2055,
), CompactEnsuringGap`

My source code compiles and runs successfully. The stack trace of the error doesn't give me a clue on where in my source code scalariform might have a problem. Any help?

The full stack trace:

java.lang.IllegalArgumentException: requirement failed:  cannot do 'before' formatting for NEWLINE* tokens: Token(NEWLINE,
    ,2055,
    ), CompactEnsuringGap
  at scala.Predef$.require(Predef.scala:214)
  at scalariform.formatter.FormatResult.before(FormatResult.scala:18)
  at scalariform.formatter.TypeFormatter$$anonfun$format$2.apply(TypeFormatter.scala:23)
  at scalariform.formatter.TypeFormatter$$anonfun$format$2.apply(TypeFormatter.scala:17)
  at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
  at scala.collection.immutable.List.foreach(List.scala:76)
  at scalariform.formatter.TypeFormatter$class.format(TypeFormatter.scala:17)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.TypeFormatter$class.format(TypeFormatter.scala:13)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.TypeFormatter$class.scalariform$formatter$TypeFormatter$$format(TypeFormatter.scala:46)
  at scalariform.formatter.TypeFormatter$$anonfun$format$2.apply(TypeFormatter.scala:39)
  at scalariform.formatter.TypeFormatter$$anonfun$format$2.apply(TypeFormatter.scala:17)
  at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
  at scala.collection.immutable.List.foreach(List.scala:76)
  at scalariform.formatter.TypeFormatter$class.format(TypeFormatter.scala:17)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:798)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:770)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:764)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ExprFormatter$class.scalariform$formatter$ExprFormatter$$format(ExprFormatter.scala:716)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15$$anonfun$apply$7.apply(ExprFormatter.scala:705)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15$$anonfun$apply$7.apply(ExprFormatter.scala:695)
  at scala.Option.foreach(Option.scala:197)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15.apply(ExprFormatter.scala:695)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15.apply(ExprFormatter.scala:688)
  at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
  at scala.collection.immutable.List.foreach(List.scala:76)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:688)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:656)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.TemplateFormatter$class.scalariform$formatter$TemplateFormatter$$format(TemplateFormatter.scala:84)
  at scalariform.formatter.TemplateFormatter$$anonfun$format$7.apply(TemplateFormatter.scala:68)
  at scalariform.formatter.TemplateFormatter$$anonfun$format$7.apply(TemplateFormatter.scala:67)
  at scala.Option.foreach(Option.scala:197)
  at scalariform.formatter.TemplateFormatter$class.format(TemplateFormatter.scala:67)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:772)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:764)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ExprFormatter$class.scalariform$formatter$ExprFormatter$$format(ExprFormatter.scala:716)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15$$anonfun$apply$7.apply(ExprFormatter.scala:705)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15$$anonfun$apply$7.apply(ExprFormatter.scala:695)
  at scala.Option.foreach(Option.scala:197)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15.apply(ExprFormatter.scala:695)
  at scalariform.formatter.ExprFormatter$$anonfun$format$15.apply(ExprFormatter.scala:688)
  at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
  at scala.collection.immutable.List.foreach(List.scala:76)
  at scalariform.formatter.ExprFormatter$class.format(ExprFormatter.scala:688)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:26)
  at scalariform.formatter.ScalaFormatter.format(ScalaFormatter.scala:42)
  at scalariform.formatter.ScalaFormatter$$anon$1.format(ScalaFormatter.scala:461)
  at scalariform.formatter.ScalaFormatter$$anon$1.format(ScalaFormatter.scala:455)
  at scalariform.formatter.SpecificFormatter$class.fullFormat(SpecificFormatter.scala:79)
  at scalariform.formatter.ScalaFormatter$$anon$1.fullFormat(ScalaFormatter.scala:455)
  at scalariform.formatter.ScalaFormatter$.formatAsEdits(ScalaFormatter.scala:464)
  at scalariform.formatter.ScalaFormatter$.format(ScalaFormatter.scala:448)
  at com.typesafe.sbt.Scalariform$$anonfun$performFormat$1$2.apply(Scalariform.scala:76)
  at com.typesafe.sbt.Scalariform$$anonfun$performFormat$1$2.apply(Scalariform.scala:73)
  at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:743)
  at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:130)
  at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:275)
  at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:275)
  at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:742)
  at com.typesafe.sbt.Scalariform$.performFormat$1(Scalariform.scala:73)
  at com.typesafe.sbt.Scalariform$$anonfun$com$typesafe$sbt$Scalariform$$formatTask$1.apply(Scalariform.scala:90)
  at com.typesafe.sbt.Scalariform$$anonfun$com$typesafe$sbt$Scalariform$$formatTask$1.apply(Scalariform.scala:90)
  at com.typesafe.sbt.Scalariform$.handleUpdate$1(Scalariform.scala:102)
  at com.typesafe.sbt.Scalariform$$anonfun$handleFiles$1.apply(Scalariform.scala:105)
  at com.typesafe.sbt.Scalariform$$anonfun$handleFiles$1.apply(Scalariform.scala:105)
  at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3$$anonfun$apply$4.apply(Tracked.scala:202)
  at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3$$anonfun$apply$4.apply(Tracked.scala:198)
  at sbt.Difference.apply(Tracked.scala:177)
  at sbt.Difference.apply(Tracked.scala:158)
  at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3.apply(Tracked.scala:198)
  at sbt.FileFunction$$anonfun$cached$2$$anonfun$apply$3.apply(Tracked.scala:197)
  at sbt.Difference.apply(Tracked.scala:177)
  at sbt.Difference.apply(Tracked.scala:152)
  at sbt.FileFunction$$anonfun$cached$2.apply(Tracked.scala:197)
  at sbt.FileFunction$$anonfun$cached$2.apply(Tracked.scala:195)
  at com.typesafe.sbt.Scalariform$.handleFiles(Scalariform.scala:105)
  at com.typesafe.sbt.Scalariform$.com$typesafe$sbt$Scalariform$$formatTask(Scalariform.scala:90)
  at com.typesafe.sbt.Scalariform$$anonfun$needToBeScopedScalariformSettings$1.apply(Scalariform.scala:48)
  at com.typesafe.sbt.Scalariform$$anonfun$needToBeScopedScalariformSettings$1.apply(Scalariform.scala:48)
  at sbt.Scoped$$anonfun$hf9$1.apply(Structure.scala:585)
  at sbt.Scoped$$anonfun$hf9$1.apply(Structure.scala:585)
  at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
  at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
  at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
  at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
  at sbt.std.Transform$$anon$5.work(System.scala:71)
  at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
  at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
  at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
  at sbt.Execute.work(Execute.scala:238)
  at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
  at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
  at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
  at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
  at java.lang.Thread.run(Thread.java:722)

This seems to be a Scalariform bug, not a sbt-scalariform one. Please file it there. Thanks!