1

我尝试编写一个片段来实现这一点:

可扩展领域:

<something I don't know how to write>(my_class#($1))

预期结果:

如果 $1 为空:

`my_factory_utils(my_class)

如果 $1 不为空:

`my_factory_param_utils(my_class#(<$1 content>))

谁能给我一个关于我该怎么做的线索?

谢谢

4

1 回答 1

1

您想在镜像上使用转换

# -*- 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)

请参阅文档

于 2014-06-17T14:29:03.113 回答