本文整理汇总了Scala中com.typesafe.sbt.SbtScalariform类的典型用法代码示例。如果您正苦于以下问题:Scala SbtScalariform类的具体用法?Scala SbtScalariform怎么用?Scala SbtScalariform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SbtScalariform类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: Formatting
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import scalariform.formatter.preferences.FormattingPreferences
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] =
SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
def formattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
def docFormattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
}
示例2: Scalariform
//设置package包名称以及导入依赖的类
package org.hammerlab.sbt.plugin
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
object Scalariform
extends Plugin {
object autoImport {
val enableScalariform = (
SbtScalariform.defaultScalariformSettings ++
Seq(
ScalariformKeys.preferences :=
ScalariformKeys.preferences.value
.setPreference(AlignParameters, true)
.setPreference(CompactStringConcatenation, false)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
)
)
}
}
示例3: ScalariformSettings
//设置package包名称以及导入依赖的类
import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object ScalariformSettings {
val customScalariformSettings = SbtScalariform.defaultScalariformSettings ++ Seq(
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(CompactControlReadability, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
)
}
示例4: Build
//设置package包名称以及导入依赖的类
import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Build extends sbt.Build {
lazy val root = Project("SampleProject", file("."))
.settings(basicSettings: _*)
.settings(libraryDependencies ++= Dependencies.basic)
lazy val basicSettings = Seq(
organization := "your.organization",
version := "0.1.0",
scalaVersion := "2.11.7",
scalacOptions ++= Seq("-unchecked", "-deprecation"),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
resolvers ++= Seq(
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"))
// scalariform code format settings
SbtScalariform.scalariformSettings // enable scalariformSettings
import scalariform.formatter.preferences._
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(IndentSpaces, 2)
}
object Dependencies {
// ---- define dependencies libs
var basic: Seq[ModuleID] = Seq(
"io.spray" %% "spray-can" % "1.3.3" withSources() withJavadoc(),
"io.spray" %% "spray-routing" % "1.3.3" withSources() withJavadoc(),
"io.spray" %% "spray-json" % "1.3.2",
"io.spray" %% "spray-client" % "1.3.3",
"io.spray" %% "spray-testkit" % "1.3.3" % "test",
"com.typesafe.akka" %% "akka-actor" % "2.3.11",
"com.typesafe.akka" %% "akka-remote" % "2.3.11",
"com.typesafe.akka" %% "akka-contrib" % "2.3.11",
"com.typesafe.akka" %% "akka-testkit" % "2.3.11",
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"commons-io" % "commons-io" % "2.4" % "test",
"org.specs2" %% "specs2-core" % "2.3.11" % "test",
"org.scalaz" %% "scalaz-core" % "7.1.0"
)
}
示例5: Formatting
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = AllRequirements
override def requires: Plugins = SbtScalariform
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] = formatSettings
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(SpacesAroundMultiImports, true)
}
示例6: Formatting
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = AllRequirements
override def requires: Plugins = SbtScalariform
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] = formatSettings
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, true)
}
示例7: ScalariformSupport
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object ScalariformSupport {
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
}
示例8: Settings
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import scala.collection.immutable.Seq
import scalariform.formatter.preferences.FormattingPreferences
object Settings {
object Formatting {
lazy val formatSettings: Seq[Setting[_]] = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
lazy val docFormatSettings: Seq[Setting[_]] = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := docFormattingPreferences,
ScalariformKeys.preferences in Test := docFormattingPreferences
)
def formattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
def docFormattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
}
}
示例9: Format
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Format {
lazy val settings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
def formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, false)
.setPreference(AlignArguments, false)
.setPreference(AlignSingleLineCaseStatements, true)
}
}