我想自动格式化2.11 scala项目。
/src/main/scala
下的scala代码似乎已经很好地格式化了,但是,下面的build.sbt不是。我想对齐%%,%和=>。
我的project/scalariform.sbt
:
resolvers += Resolver.typesafeRepo("releases")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
我的build.sbt
:
name := "test"
version := "0.0.1-SNAPSHOT"
scalaVersion := "2.11.8"
libraryDependencies ++= {
val sparkVersion = "2.0.1"
val hadoopVersion = "2.7.0"
Seq("org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
"org.apache.spark" %% "spark-mllib" % sparkVersion % Provided,
"org.apache.hadoop" % "hadoop-common" % hadoopVersion
)
}
resolvers ++= Seq(
"Cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
)
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs@_*) => MergeStrategy.discard
case x => MergeStrategy.first
}
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
SbtScalariform.scalariformSettings
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(AlignParameters, true)
.setPreference(DoubleIndentClassDeclaration, true)
感谢您的帮助