当前位置: 首页>>代码示例>>Scala>>正文


Scala SbtScalariform类代码示例

本文整理汇总了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)
  }
} 
开发者ID:aiyanbo,项目名称:scala-i18n,代码行数:33,代码来源:Formatting.scala

示例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)
        )
      )
  }
} 
开发者ID:hammerlab,项目名称:sbt-parent,代码行数:26,代码来源:Scalariform.scala

示例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)
  )
} 
开发者ID:rfmejia,项目名称:massbank-record-reader,代码行数:17,代码来源:Scalariform.scala

示例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"
    )

} 
开发者ID:BabakAp,项目名称:ProjectFB,代码行数:54,代码来源:Build.scala

示例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)
} 
开发者ID:jrudolph,项目名称:scala-reified-patterns,代码行数:28,代码来源:Formatting.scala

示例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)
} 
开发者ID:jrudolph,项目名称:scodec-cheatsheet,代码行数:27,代码来源:Formatting.scala

示例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)

} 
开发者ID:jrudolph,项目名称:sbt-optimizer,代码行数:21,代码来源:ScalariformSupport.scala

示例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)
    }
  }

} 
开发者ID:aiyanbo,项目名称:sbt-dependency-updates,代码行数:39,代码来源:Settings.scala

示例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)
  }

} 
开发者ID:iheartradio,项目名称:happy-path,代码行数:21,代码来源:Format.scala


注:本文中的com.typesafe.sbt.SbtScalariform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。