【webstrom - Live Template - Edit variables】Edit variables翻译

WebStorm的Live Template(热加载模板)通过预定义代码缩写提升开发效率。本文介绍了如何自定义JavaScript注释模板,并重点讲解了在Live Template变量中使用的预定义函数及其参数。

Live Template

用中文应该叫做热加载模板。它的原理就是配置一些常用代码字母缩写,在输入简写时可以出现你预制的模板内容,使得开发效率大大提高。


Webstorm js中,自定义js说明注释(文档描述、作者、创建日期等): 
快捷键 Ctrl + Shift + S 打开Webstorm设置,搜索‘Live Template’,找到JavaScript,如下:

è¿éåå¾çæè¿°

点击右上角“+”-> Live Template,添加注释模板,出现以下界面,填写相关的信息: 

下面我要介绍的是 Edit variables

 

Predefined Functions to Use in Live Template Variables  的参数如下:

Item

Description

blockCommentEnd

Returns the characters that indicate the end of a block comment in the current language context.返回指示当前语言上下文中块注释结尾的字符。

blockCommentStart

Returns the characters that indicate the start of a block comment in the current language context.返回指示当前语言上下文中块注释开头的字符。

camelCase(String)

Converts a string into camelCase. For example, camelCase(my-text-file)camelCase(my text file), and camelCase(my_text_file) all return myTextFile.

将字符串转换为驼色大小写。例如, camelCase(my-text-file), camelCase(my text file), and camelCase(my_text_file) 这三种都返回 myTextFile.

capitalize(String)

Capitalizes the first letter of the parameter.

将参数的第一个字母大写。

capitalizeAndUnderscore(sCamelCaseName)

Capitalizes all the letters of a CamelCase name passed as the parameter, and inserts an underscore between the parts. For example, capitalizeAndUnderscore(FooBar) returnsFOO_BAR.

将参数所有字母大写,并在各部分之间插入下划线。例如,如capitalizeAndUnderscore(FooBar),返回FOO_BAR

classNameComplete()

This expression substitutes for the class name completion at the variable position.

此表达式在变量位置替换类名完成。

clipboard()

Returns the contents of the system clipboard.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值