webstorm 有没有console.log 或console.info 的快捷方式? [英] Does webstorm have some shortcut for console.log or console.info?
问题描述
只是厌倦了一遍遍的输入console.log
,又没有找到像Eclipse中Sysout + Control + Space
这样的方式会创建System.out.println()
.
Just tired of typing console.log
again and again, and do not find a way like Sysout + Control + Space
in Eclipse will create System.out.println()
.
推荐答案
有一个预定义的 Postfix 模板,允许您在 JavaScript 表达式或字符串后键入 .log 并按 Tab 将其转换为 console.log().
There's a predefined Postfix template that allows you to type .log after a JavaScript expression or string and hit Tab to transform it to console.log().
您还可以创建一个实时模板(请参阅首选项 | 编辑器 | 实时模板),一旦您键入所选缩写并点击 Tab,它就会扩展为代码片段.
You can also create a Live template (see Preferences | Editor | Live templates) that would expand into a code snippet once you type the selected abbreviation and hit Tab.
更新:现在还有一个插件允许您使用快捷方式添加 console.log:https://plugins.jetbrains.com/plugin/10986-console-log
Update: there's now also a plugin that allows you to add console.log with a shortcut: https://plugins.jetbrains.com/plugin/10986-console-log
这篇关于webstorm 有没有console.log 或console.info 的快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!