vscode/extensions/swift/snippets/swift.json
2016-11-11 17:13:36 +01:00

133 lines
2.1 KiB
JSON

{
"print(\"...\")": {
"prefix": "pr",
"body": "print(\"$1\")$0"
},
"print(\"\\(...)\")": {
"prefix": "po",
"body": "print(\"\\($1)\")$0"
},
"repeat...while loop": {
"prefix": "repeat",
"body": [
"repeat {",
" $0",
"} while ${1:true}"
],
"description": "repeat...while loop"
},
"While loop": {
"prefix": "while",
"body": [
"while ${1:true} {",
" $0",
"}"
],
"description": "While loop"
},
"For-In statement": {
"prefix": "forin",
"body": [
"for ${1:item} in ${2:collection} {",
" $0",
"}"
],
"description": "For-In statement"
},
"Reverse for loop": {
"prefix": "forr",
"body": [
"for var ${1:i} = ${2:length} - 1; ${1:i} >= 0; ${1:i}-- {",
" $0",
"}"
],
"description": "Reverse for loop"
},
"for loop": {
"prefix": "for",
"body": [
"for var ${1:i} = 0; ${1:i} < ${2:length}; ${1:i}++ {",
" $0",
"}"
],
"description": "for loop"
},
"if statement": {
"prefix": "if",
"body": [
"if ${1:true} {",
" $0",
"}"
],
"description": "if statement"
},
"else-if statement": {
"prefix": "elif",
"body": [
"else if ${1:true} {",
" $0",
"}"
],
"description": "if statement"
},
"Else statement": {
"prefix": "else",
"body": [
"else {",
" $0",
"}"
],
"description": "Else statement"
},
"Guard statement": {
"prefix": "guard",
"body": [
"guard let ${1:a} = ${2:optional} else {",
" $0",
"}"
],
"description": "Guard statement"
},
"Optional Binding statement": {
"prefix": "ifnil",
"body": [
"if let ${1:a} = ${2:optional} {",
" $0",
"}"
],
"description": "Optional Binding statement"
},
"Switch statement": {
"prefix": "switch",
"body": [
"switch ${1:switch_on} {",
"case ${2:a}:",
" $0",
"default:",
" $1",
"}"
],
"description": "Switch statement"
},
"Do catch": {
"prefix": "docatch",
"body": [
"do {",
" try ${1:function that throws}",
"} catch ${2:pattern} {",
" $0",
"}"
],
"description": "Try catch"
},
"Enum": {
"prefix": "enum",
"body": [
"enum ${1:Name} {",
" case $0",
"}"
],
"description": "Enum"
}
}