Skip to content
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 snippets for python comprehensions #1750

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

afallou
Copy link
Contributor

@afallou afallou commented Feb 12, 2025

Why?

Those are somewhat hard to build by voice without a snippet, and are used very often in Python.

What?

Add snippet for python list, dictionary and set comprehensions.

Why?
Those are little bit hard to build without a snippet.

What?
Add snippet for python list, dictionary and set comprehensions.
phrase: dict comp
insertionScope: statement
-
{$0: $2 for $2 in $1}
Copy link
Contributor Author

@afallou afallou Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all three cases the first element to fill out in the snippet is the object being iterated on, as it enables the IDE to help in filling out the other parts through suggestions.
In the dictionary case I extended that to fill the snippet out from right to left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant