Webstorm 文件模板/用户代码片段

2020-02-22  本文已影响0人  LeungJhowe

一、创建模板

步骤
1.菜单栏file--settings,
2.左列表editor---File and Code Templates,
3.Files标签下点击"+",右板块编辑模板名和内容
4.ok or apply
具体图文步骤



例子:文件注释介绍

/**
 * @Author: Jhowe
 * @createdTime: ${YEAR}-${MONTH}-${DATE} ${HOUR}:${MINUTE}
 * @description: 
 */

Webstorm模板变量

${PROJECT_NAME} - the name of the current project(当前项目名).

${NAME} - the name of the new file which you specify in the New File dialog box during the file creation.(文件名)

${USER} - the login name of the current user.(webstorm用户名)

${DATE} - the current system date.(当前日期)

${TIME} - the current system time.(当前时间)

${YEAR} - the current year.(当前年份)

${MONTH} - the current month.(当前月份)

${DAY} - the current day of the month.(当前日期)

${HOUR} - the current hour.(当前小时)

${MINUTE} - the current minute.(当前分)

${PRODUCT_NAME} - the name of the IDE in which the file will be created.

${MONTH_NAME_SHORT} - the first 3 letters of the month name. Example: Jan, Feb, etc.

${MONTH_NAME_FULL} - full name of a month. Example: January, February, etc.

二、用户代码片段

步骤
1.菜单栏file--settings,
2.左列表editor---Live Templates
3.右板块”+“新建模板live template
4.下方编辑模板的名字,内容和其他变量 个性化
具体图文步骤


image.png

参考
[IDEA]IDEA设置注释模板

自用配置

//<!--f
<!--<editor-fold desc="" >-->
          
<!--</editor-fold>-->

上一篇下一篇

猜你喜欢

热点阅读