Add snippets for kotlin (#246)

This commit is contained in:
James N 2018-02-22 00:03:07 -08:00 committed by Andrea Crotti
parent d88001c1fb
commit 26b33acf8c
17 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Anonymous class
# key: object
# --
object: $1 {
$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Closure (function without name)
# key: closure
# --
{ $1 -> $0 }

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Extension function
# key: exfun
# --
fun $1.$2($3): $4 {
$0
}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Extension read-only property
# key: exval
# --
val $1.$2: $3
get() {
$0
}

View File

@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: Extension read-write property
# key: exvar
# --
var $1.$2: $3
get() {
$0
}
set(value) {
}

7
snippets/kotlin-mode/fun Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Function with no parameters
# key: fun0
# --
fun $1($2): $3 {
$0
}

7
snippets/kotlin-mode/ifn Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Inserts 'if null' expression
# key: ifn
# --
if ($1 == null) {
$0
}

7
snippets/kotlin-mode/inn Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Inserts 'if not null' expression
# key: inn
# --
if ($1 != null) {
$0
}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Interface
# key: interface
# --
interface $1 {
$0
}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Iterate over elements of iterable (for-in) loop
# key: iter
# --
for ($1 in $2) {
$0
}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: main() function
# key: main
# --
fun main(args: Array<string>) {
$0
}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: psvm
# key: psvm
# --
fun main(args: Array<string>) {
$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Prints a string to System.err
# key: serr
# --
System.err.println($0)

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Singleton
# key: singleton
# --
object $1 {
$0
}

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Prints a string to System.out
# key: sout
# --
println($0)

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Prints a value to System.out
# key: soutv
# --
println("$0 = ${$0}")

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: Function returning nothing
# key: void
# --
fun $1($2) {
$0
}