Files
vscode/extensions/swift/snippets/swift.json
Alexis Aubry 5f71983134 Update Swift Autocompletion Syntax
Performed updates to the Swift Snippets JSON so that they match the latest language syntax

Updated :

- print()
- repeat {} while

Added :

- Guard statement
- Optional Binding Statement
2016-02-20 15:18:59 +01:00

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