Scala 代码格式:如何对齐<;-在里面理解?
我有一个理解的Scala 代码格式:如何对齐<;-在里面理解?,scala,intellij-idea,Scala,Intellij Idea,我有一个理解的,如下: private[helper] def myMethod(name: String, index: Long) = { for { result1 <- httpUtilities.getLowIndexes(index) result2 <- myFacade.queryMaterial(result1) result3 <- httpUtilities.someMethod(result2) } yield resul
,
如下:
private[helper] def myMethod(name: String, index: Long) = {
for {
result1 <- httpUtilities.getLowIndexes(index)
result2 <- myFacade.queryMaterial(result1)
result3 <- httpUtilities.someMethod(result2)
} yield result3
}
private[helper]def myMethod(名称:String,索引:Long)={
为了{
结果1可以完全做到这一点,它可以作为一个组件使用,并且可以通过许多其他方式进行打包
您想使用align=more
功能。文档显示了以下对齐示例:
val x = 2 // true for assignment
val xx = 22
case object B extends A // false for `extends`
case object BB extends A
q -> 22 // true for various infix operators
qq -> 3 // and also comments!
for {
x <- List(1) // true for alignment enumerator
yy <- List(2)
} yield x ** xx
x match { // true for multiple tokens across multiple lines
case 1 => 1 -> 2 // first
case 11 => 11 -> 22 // second
// A blank line separates alignment blocks.
case `ignoreMe` => 111 -> 222
}
// Align assignments of similar type.
def name = column[String]("name")
def status = column[Int]("status")
val x = 1
val xx = 22
// Align sbt module IDs.
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"com.lihaoyi" %% "sourcecode" % "0.1.1"
)
val x=2//赋值为true
val xx=22
case对象B扩展了A//false,表示“扩展”`
case对象BB扩展了
q->22//适用于各种中缀运算符
qq->3//还有评论!
为了{
x2//首先
案例11=>11->22//秒
//空白行分隔对齐块。
案例'ignoreMe`=>111->222
}
//对齐类似类型的指定。
def名称=列[字符串](“名称”)
定义状态=列[Int](“状态”)
val x=1
val xx=22
//对齐sbt模块ID。
libraryDependencies++=Seq(
“org.scala lang”%”scala编译器“%scalaVersion.value,
“com.lihaoyi”%%“源代码”%%“0.1.1”
)
val x = 2 // true for assignment
val xx = 22
case object B extends A // false for `extends`
case object BB extends A
q -> 22 // true for various infix operators
qq -> 3 // and also comments!
for {
x <- List(1) // true for alignment enumerator
yy <- List(2)
} yield x ** xx
x match { // true for multiple tokens across multiple lines
case 1 => 1 -> 2 // first
case 11 => 11 -> 22 // second
// A blank line separates alignment blocks.
case `ignoreMe` => 111 -> 222
}
// Align assignments of similar type.
def name = column[String]("name")
def status = column[Int]("status")
val x = 1
val xx = 22
// Align sbt module IDs.
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"com.lihaoyi" %% "sourcecode" % "0.1.1"
)