I try to write a snippet to achieve this:
Expandable field:
<something I don't know how to write>(my_class#($1))
Expected result:
If $1 is empty:
`my_factory_utils(my_class)
If $1 is not empty:
`my_factory_param_utils(my_class#(<$1 content>))
Could anyone give me a clue about how could I do that?
Thanks
You want to use transformations on mirrors
# -*- mode: snippet -*-
# name: testsnip
# key: testsnip
# --
${1:$(if (zerop (length yas-text)) "my_factory_utils" "my_factory_param_utils")}(my_class${1:$(if (zerop (length yas-text)) "" "#")}$1)
See docs.