Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 6d026e3

Browse files
committed
Improve class snippet to format the __init__ args
By pressing tab after entering the __init__ method args, the args are formatted to be assigned as class attributes.
1 parent 140c6f5 commit 6d026e3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@ Thanks!
107107
## Release Notes
108108

109109
See [changelog](CHANGELOG.md) for all changes and releases.
110+
111+
## Troubleshooting
112+
113+
If you experience problems with the auto-formatting of certain snippets, make sure you have the option `editor.tabCompletion` set on `onlySnippets` or `on`.

‎snippets/base.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"\t\"\"\"${3:docstring for 1ドル.}\"\"\"",
5353
"\tdef __init__(self, ${4:arg}):",
5454
"\t\t${5:super(1,ドル self).__init__()}",
55-
"\t\tself.$4 = $4",
56-
"\t\t0ドル"
55+
"\t${4/([^,=]+)(?:=[^,]+)?(,\\s*|)/\tself.$1 = $1${2:+\n\t}/g}",
56+
"\n\t0ドル"
5757
],
5858
"description" : "Code snippet for a class definition."
5959
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /