From 52ef2d5c3390ca59dd71aac290151f9cff74fb2e Mon Sep 17 00:00:00 2001 From: Rohan Pandit Date: Wed, 19 Jan 2022 10:11:13 +0000 Subject: [PATCH 1/5] Code snippet for do-while loop equivalent --- snippets/base.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/base.json b/snippets/base.json index f99bd4a..13d507f 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -121,6 +121,11 @@ "body": "while ${1:condition}:\n\t${2:pass}$0", "description" : "Code snippet to create a while loop structure." }, + "dowhile": { + "prefix": "dowhile", + "body": "do = True \nwhile do or ${1:condition}:\n\t{2:body}\n\tdo = False$0", + "description" : "Code snippet to create a do-while loop structure." + }, "try:except:": { "prefix": "try", "body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}$0", From 97f44062e7ba7414ae7ed148394e77a3fe211224 Mon Sep 17 00:00:00 2001 From: Rohan Pandit Date: Wed, 19 Jan 2022 10:12:24 +0000 Subject: [PATCH 2/5] Code snippet for lambda function --- snippets/base.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/base.json b/snippets/base.json index 13d507f..ae28ea1 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -160,5 +160,10 @@ "prefix": "ifmain", "body": "if __name__ == \"__main__\":\n\t${1:main()}$0", "description" : "Create implicitly all the code at the top level using the __name__ special variable." + }, + "lambda": { + "prefix": "lam", + "body": "lambda ${1:args}: ${2:expr}", + "description": "Create template for lambda function" } } From b2268c76822a2fcff60b4560918cb4134a40ce12 Mon Sep 17 00:00:00 2001 From: Rohan Pandit Date: Wed, 19 Jan 2022 10:28:50 +0000 Subject: [PATCH 3/5] Edit body before condition in dowhile snippet --- snippets/base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/base.json b/snippets/base.json index ae28ea1..357db23 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -123,7 +123,7 @@ }, "dowhile": { "prefix": "dowhile", - "body": "do = True \nwhile do or ${1:condition}:\n\t{2:body}\n\tdo = False$0", + "body": "do = True \nwhile do or ${2:condition}:\n\t${1:body}\n\tdo = False$0", "description" : "Code snippet to create a do-while loop structure." }, "try:except:": { From 6a4df81ea4076e91e15f415978ecba72e94be462 Mon Sep 17 00:00:00 2001 From: Rohan Pandit Date: Wed, 19 Jan 2022 10:40:33 +0000 Subject: [PATCH 4/5] Set do to False before loop body --- snippets/base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/base.json b/snippets/base.json index 357db23..a05c405 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -123,7 +123,7 @@ }, "dowhile": { "prefix": "dowhile", - "body": "do = True \nwhile do or ${2:condition}:\n\t${1:body}\n\tdo = False$0", + "body": "do = True \nwhile do or ${2:condition}:\n\tdo = False\n\t${1:body}$0", "description" : "Code snippet to create a do-while loop structure." }, "try:except:": { From c2631eb855b4aa24d68d9dacf895e974cdebd858 Mon Sep 17 00:00:00 2001 From: Rohan Pandit Date: Wed, 19 Jan 2022 10:43:29 +0000 Subject: [PATCH 5/5] Remove whitespace after do = True --- snippets/base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/base.json b/snippets/base.json index a05c405..d44d22f 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -123,7 +123,7 @@ }, "dowhile": { "prefix": "dowhile", - "body": "do = True \nwhile do or ${2:condition}:\n\tdo = False\n\t${1:body}$0", + "body": "do = True\nwhile do or ${2:condition}:\n\tdo = False\n\t${1:body}$0", "description" : "Code snippet to create a do-while loop structure." }, "try:except:": {