Dynamic placeholders
Is there a way to create dynamic placeholders such that I may produce looping snippets?
snippet param "py.test parameterize decorator" b
@pytest.
`!p from itertools import count
counter = count(3)
while True:
snip += "(${{{0}: 'test'}}, ${{{1}: 'result'
if not snip.rv.
break`
])$0
endsnippet
I'm looking for this to produce as many lines of ('test', 'result'), as I'd like, and would continue until I remove the trailing comma, at which point, it completes the snippet and moves to the final placeholder. Note the string formatting taking place in each of those lines that makes the first appear as "(${3: 'test'}, ${4: 'result'})${5:,}". Is this at all possible?
I'd also like to thank you for such a wonderful tool.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- UltiSnips Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- SirVer
- Solved:
- Last query:
- Last reply: