Open irigone opened 4 years ago
How hard is that and how do I achieve it?
It's not extremely hard, but you have to type some elisp. You have to decide on a snippet trigger, or a keybinding. As you say, on a way to trigger the snippet. Then you have to write an elisp function that parses the __init__
definition, finds a suitable spot to put the new the new self._$1 = $1
bit, and dinamicallly generates a snippet that contains the text you want to preserve + the new bits you want to add.
Then you call yas-expand-snippet
on that.
Alright, I'll write it today but when I wake up (3 AM already)
I tried to find that in issues but couldn't :( I use this snippet
I have this code:
I want to add a property called "grade" in that class. So I type
,grade
to the right offullname
(in the__init__
part). I want yasnippet to somehow track that (either automatically or by a shortcut) and addself._grade = grade
under otherself.something
thingies. How hard is that and how do I achieve it?