init
This commit is contained in:
8
snippets/scala-mode/app
Normal file
8
snippets/scala-mode/app
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
|
||||
# name: object name extends App
|
||||
# key: app
|
||||
# --
|
||||
object ${1:name} extends App {
|
||||
$0
|
||||
}
|
||||
6
snippets/scala-mode/case
Normal file
6
snippets/scala-mode/case
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: case pattern =>
|
||||
# key: case
|
||||
# --
|
||||
case ${1:_} => $0
|
||||
8
snippets/scala-mode/cc
Normal file
8
snippets/scala-mode/cc
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Sam Halliday
|
||||
# name: case class T(arg: A)
|
||||
# key: cc
|
||||
# --
|
||||
case class ${1:Name}(
|
||||
${2:arg}: ${3:Type}
|
||||
)
|
||||
6
snippets/scala-mode/co
Normal file
6
snippets/scala-mode/co
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: case object T
|
||||
# key: co
|
||||
# --
|
||||
case object ${1:name} $0
|
||||
6
snippets/scala-mode/cons
Normal file
6
snippets/scala-mode/cons
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: element1 :: element2
|
||||
# key: cons
|
||||
# --
|
||||
${1:element1} :: ${2:element2} $0
|
||||
8
snippets/scala-mode/def
Normal file
8
snippets/scala-mode/def
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: def f(arg: T): R = {...}
|
||||
# key: def
|
||||
# --
|
||||
def ${1:name}(${2:args}): ${3:Unit} = {
|
||||
$0
|
||||
}
|
||||
9
snippets/scala-mode/doc
Normal file
9
snippets/scala-mode/doc
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Anders Bach Nielsen <andersbach.nielsen@epfl.ch>
|
||||
# name: /** ... */
|
||||
# key: doc
|
||||
# --
|
||||
/**
|
||||
* ${1:description}
|
||||
* $0
|
||||
*/
|
||||
40
snippets/scala-mode/docfun
Normal file
40
snippets/scala-mode/docfun
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- mode: snippet -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
# name: docstring function
|
||||
# contributor: Andrea Giugliano
|
||||
# key: docfun
|
||||
# inspired by a snippet by Tibor Simko et al.
|
||||
# --
|
||||
/**
|
||||
* $1
|
||||
* ${3:$
|
||||
(let* ((indent
|
||||
(concat "\n * "))
|
||||
(args
|
||||
(mapconcat
|
||||
'(lambda (x)
|
||||
(if (not (string= (nth 0 x) ""))
|
||||
;; in Scala I get a separator : for the type
|
||||
(let ((par-type (mapcar 'string-trim (split-string (nth 0 x) ":")))) (concat "@param " (first par-type) indent "@tparam " (second par-type) indent))
|
||||
))
|
||||
(mapcar
|
||||
'(lambda (x)
|
||||
(mapcar
|
||||
'(lambda (x)
|
||||
(replace-regexp-in-string "[[:blank:]]*$" ""
|
||||
(replace-regexp-in-string "^[[:blank:]]*" "" x)))
|
||||
x))
|
||||
(mapcar '(lambda (x) (split-string x "="))
|
||||
(split-string yas-text ",")))
|
||||
indent)))
|
||||
(if (string= args "")
|
||||
(concat indent "@return: " indent "@rtype: " indent (make-string 3 34))
|
||||
(mapconcat
|
||||
'identity
|
||||
(list "" args )
|
||||
indent)))
|
||||
}
|
||||
* @return ${4:$(yas-text)}
|
||||
*
|
||||
**/
|
||||
def ${2:name}($3): $4 = $0
|
||||
8
snippets/scala-mode/for
Normal file
8
snippets/scala-mode/for
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Sam Halliday
|
||||
# name: for { x <- xs } yield
|
||||
# key: for
|
||||
# --
|
||||
for {
|
||||
${1:x} <- ${2:xs}
|
||||
} yield ${3:x}
|
||||
8
snippets/scala-mode/if
Normal file
8
snippets/scala-mode/if
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: if (cond) { .. }
|
||||
# key: if
|
||||
# --
|
||||
if (${1:condition}) {
|
||||
$0
|
||||
}
|
||||
6
snippets/scala-mode/ls
Normal file
6
snippets/scala-mode/ls
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: List(..)
|
||||
# key: ls
|
||||
# --
|
||||
List(${1:args}, ${2:args}) $0
|
||||
8
snippets/scala-mode/main
Normal file
8
snippets/scala-mode/main
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: def main(args: Array[String]) = { ... }
|
||||
# key: main
|
||||
# --
|
||||
def main(args: Array[String]) = {
|
||||
$0
|
||||
}
|
||||
8
snippets/scala-mode/match
Normal file
8
snippets/scala-mode/match
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: cc match { .. }
|
||||
# key: match
|
||||
# --
|
||||
${1:cc} match {
|
||||
case ${2:pattern} => $0
|
||||
}
|
||||
6
snippets/scala-mode/ob
Normal file
6
snippets/scala-mode/ob
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: object name extends T
|
||||
# key: ob
|
||||
# --
|
||||
object ${1:name} extends ${2:type} $0
|
||||
6
snippets/scala-mode/throw
Normal file
6
snippets/scala-mode/throw
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Jonas Bonèr <jonas@jonasboner.com>
|
||||
# name: throw new Exception
|
||||
# key: throw
|
||||
# --
|
||||
throw new ${1:Exception}(${2:msg}) $0
|
||||
11
snippets/scala-mode/try
Normal file
11
snippets/scala-mode/try
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
#Author : Sam Halliday
|
||||
# name: try { .. } catch { case e => ..}
|
||||
# key: try
|
||||
# --
|
||||
try {
|
||||
$0
|
||||
} catch {
|
||||
case e: ${1:Throwable} =>
|
||||
${2:// TODO: handle exception}
|
||||
}
|
||||
6
snippets/scala-mode/valueclass
Normal file
6
snippets/scala-mode/valueclass
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# Author: Michael Pollmeier
|
||||
# name: value class
|
||||
# key: vc
|
||||
# --
|
||||
case class ${1:Name}(value: ${2:Type}) extends AnyVal
|
||||
Reference in New Issue
Block a user