Add snippets for kotlin (#246)
This commit is contained in:
parent
d88001c1fb
commit
26b33acf8c
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Anonymous class
|
||||||
|
# key: object
|
||||||
|
# --
|
||||||
|
object: $1 {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Closure (function without name)
|
||||||
|
# key: closure
|
||||||
|
# --
|
||||||
|
{ $1 -> $0 }
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Extension function
|
||||||
|
# key: exfun
|
||||||
|
# --
|
||||||
|
fun $1.$2($3): $4 {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Extension read-only property
|
||||||
|
# key: exval
|
||||||
|
# --
|
||||||
|
val $1.$2: $3
|
||||||
|
get() {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Extension read-write property
|
||||||
|
# key: exvar
|
||||||
|
# --
|
||||||
|
var $1.$2: $3
|
||||||
|
get() {
|
||||||
|
$0
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Function with no parameters
|
||||||
|
# key: fun0
|
||||||
|
# --
|
||||||
|
fun $1($2): $3 {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Inserts 'if null' expression
|
||||||
|
# key: ifn
|
||||||
|
# --
|
||||||
|
if ($1 == null) {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Inserts 'if not null' expression
|
||||||
|
# key: inn
|
||||||
|
# --
|
||||||
|
if ($1 != null) {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Interface
|
||||||
|
# key: interface
|
||||||
|
# --
|
||||||
|
interface $1 {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Iterate over elements of iterable (for-in) loop
|
||||||
|
# key: iter
|
||||||
|
# --
|
||||||
|
for ($1 in $2) {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: main() function
|
||||||
|
# key: main
|
||||||
|
# --
|
||||||
|
fun main(args: Array<string>) {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: psvm
|
||||||
|
# key: psvm
|
||||||
|
# --
|
||||||
|
fun main(args: Array<string>) {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Prints a string to System.err
|
||||||
|
# key: serr
|
||||||
|
# --
|
||||||
|
System.err.println($0)
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Singleton
|
||||||
|
# key: singleton
|
||||||
|
# --
|
||||||
|
object $1 {
|
||||||
|
$0
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Prints a string to System.out
|
||||||
|
# key: sout
|
||||||
|
# --
|
||||||
|
println($0)
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Prints a value to System.out
|
||||||
|
# key: soutv
|
||||||
|
# --
|
||||||
|
println("$0 = ${$0}")
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: Function returning nothing
|
||||||
|
# key: void
|
||||||
|
# --
|
||||||
|
fun $1($2) {
|
||||||
|
$0
|
||||||
|
}
|
Loading…
Reference in New Issue