forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a snippet for the if __name__ == '__main__':
block
#2242
Labels
feature-request
Request for new features or functionality
Milestone
Comments
d3r3kk
added
feature-request
Request for new features or functionality
feature-*
labels
Jul 24, 2018
Instead of |
I would actually say that's not the best snippet since there's no expectation to define a |
I personally just want: if __name__ == "__main__":
${1} Or whatever is required to have VS Code start the cursor indented in the |
rsnk96
added a commit
to rsnk96/vscode-python
that referenced
this issue
Oct 13, 2018
Added snippet to check if program is being run directly or imported without a separate `main()` function (microsoft#2242)
6 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We have all sorts of useful snippets in our extension, but I've noticed that we have not added one for the ubiquitous block:
if __name__ == '__main__':
Proposal to add the snippet with the type-ahead identifier
__main__
.Acceptance Criteria:
helloworld.py
__main
Expected Result
Popup with a snippet for the dunder name equals dunder main appears. Pressing
Enter
will accept the snippet and insert code such as:...where the
$
is where the cursor is left such that the user can add whatever call(s) are necessary.The text was updated successfully, but these errors were encountered: