From 5f71983134d768214fb235f1737ed3272595ef79 Mon Sep 17 00:00:00 2001 From: Alexis Aubry Date: Sat, 20 Feb 2016 15:18:59 +0100 Subject: [PATCH] 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 --- extensions/swift/snippets/swift.json | 40 +++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/extensions/swift/snippets/swift.json b/extensions/swift/snippets/swift.json index 0b9d91d9c2e..4f62a30725e 100644 --- a/extensions/swift/snippets/swift.json +++ b/extensions/swift/snippets/swift.json @@ -1,22 +1,22 @@ { - "println(\"...\")": { + "print(\"...\")": { "prefix": "pr", - "body": "println(\"$1\")$0" + "body": "print(\"$1\")$0" }, - "println(\"\\(...)\")": { + "print(\"\\(...)\")": { "prefix": "po", - "body": "println(\"\\($1)\")$0" + "body": "print(\"\\($1)\")$0" }, - "do...while loop": { + "repeat...while loop": { - "prefix": "do", + "prefix": "repeat", "body": [ - "do {", + "repeat {", " $0", "} while ${true}" ], - "description": "do...while loop" + "description": "repeat...while loop" }, "While loop": { @@ -96,6 +96,28 @@ "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", @@ -133,4 +155,4 @@ ], "description": "Enum" } -} \ No newline at end of file +}