-
Notifications
You must be signed in to change notification settings - Fork 476
Merge elpy snippets (again) #465
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
Merge elpy snippets (again) #465
Conversation
Elpy now ships with a few YASnippet snippets for Python. Fixes AndreaCrotti#43.
The enter and exit snippets now conform to the yasnippet-snippets repository (mostly), while super now makes use of the .yas-setup.el mechanism and is seriously improved. There's a new snippet for __init__ methods, too, which automatically assigns arguments to instance variables.
Previously when using the yasnippet "super", it will always return "(class, arg).method" which was the Py2 way of doing it. In Py3, you could simply do "().method" and Python will understand.
Thanks to galaunay for the idea to use this to "avoid unnecessary keyspace pollution."
Please note that python-interpreter must be set to "python3" for this to function correctly. As a side-effect it also allows the use of Python 2 on systems that install version 3 to /usr/bin/python and version 2 to /usr/bin/python2.
Thanks to Andrea Crotti for the review and suggestion.
yas-snips-snippet-init-assignments should use values provided by yas--apply-transform instead of grabbing them itself. Thanks to npostavs for finding this issue. See review discussion at PR AndreaCrotti#278 for more info (search for "yas--apply-transform").
OK this looks almost OK to me. Few things are not OK though: The The files contains:
and
It gives:
and:
also for the "newlines at end of file" is that common to add them or not add them? I spotted that when there's a newline at end of file it also get inputed in the file, so the behavior is different, I hope there's an existing concensus on this? |
@AndreaCrotti gentle ping |
Oh my indentation issue has to do with the last lines of .yas-setup.yml:
and the way I test my snippets. I was testing them by just symlinking ~/.emacs.d/snippets/ to my clone, haha. What is the proper way to run yasnippet-snippets from my clone instead of elpa? |
I was able to test it properly using: (use-package yasnippet-snippets
:load-path "~/clones/yasnippet-snippets"
) I checked ans yes, |
Using |
41a0394
to
0e7e937
Compare
OK for me everything now works as expected. |
Is there something I can do here? |
A follow up of #278.
I tried to keep it simple, not much elisp, only simple additions.
I did not tested it yet, I'd like to test it a bit before merging.
It's my very first contribution to this repo so beware :D