This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatTraverse[T](node: Node)(pfn: PartialFunction[Node, TraversableOnce[T]]): Seq[T] = { | |
traverse(node)(pfn).flatten | |
} | |
def traverse[T](node: Node)(pfn: PartialFunction[Node, T]): Seq[T] = { | |
def inner(n: Node, acc: List[T]): List[T] = n match { | |
case x if (pfn isDefinedAt x) => pfn(x) :: acc | |
case e: Elem => (e.child.toList map {inner(_, Nil)}).flatten ::: acc | |
case _ => acc | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"cmd": ["sbt-no-color compile"], | |
"file_regex": "^\\[error\\] ([.a-zA-Z0-9/-]+[.]scala):([0-9]+):", | |
"selector": "source.scala", | |
"working_dir": "${project_path:${folder}}", | |
"shell": "true" | |
} |