Skip to content

Commit 63e8110

Browse files
authored
Merge pull request cstrap#17 from macintacos/fix-class-args
Fix `class` snippet so it updates `arg` parameter inside `__init__` function on-type
2 parents 4da7935 + 9466904 commit 63e8110

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

snippets/base.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@
4747
},
4848
"New class": {
4949
"prefix": "class",
50-
"body": "class ${1:ClassName}(${2:object}):\n\t\"\"\"${3:docstring for $1.}\"\"\"\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super($1, self).__init__()}\n\t\tself.arg = arg\n\t\t$0",
50+
"body": [
51+
"class ${1:ClassName}(${2:object}):",
52+
"\t\"\"\"${3:docstring for $1.}\"\"\"",
53+
"\tdef __init__(self, ${4:arg}):",
54+
"\t\t${5:super($1, self).__init__()}",
55+
"\t\tself.$4 = $4",
56+
"\t\t$0"
57+
],
5158
"description" : "Code snippet for a class definition."
5259
},
5360
"New method": {

0 commit comments

Comments
 (0)