自定义环绕模板 [英] Custom surround template

查看:547
本文介绍了自定义环绕模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何定义我自己的自定义环绕模板,我可以使用它来包装选择的javascript代码,然后重新格式化。

How can I define my own custom surround template that I can use to wrap around a selection of javascript code followed by reformat.

我用过 Alt + Cmd + T 打开此选项面板。

I've used Alt + Cmd + T to bring up this option panel.

推荐答案

转到设置/实时模板,创建一个新的Live模板,指定缩写,描述和上下文,检查根据代码样式重新格式化

Go to Settings/Live Templates, create a new Live template, specify abbreviation, description and contexts, check Reformat according to code style.

现在重要的部分。 Live模板内容必须包含 $ SELECTION $ 变量才能适用于Surround with action。例如:

And now the important part. The Live template content must contain $SELECTION$ variable for it to be applicable for Surround with action. For instance:

console.log($SELECTION$);

保存模板后,下次使用时,应在弹出列表中看到它em> Surround With 动作。

After you save the template you should see it in the pop-up list next time you use the Surround With action.

这篇关于自定义环绕模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆