Code Snippets in PhpStorm

I am using PhpStorm. I want to make code snippets and then assign labels to them. I can do this in NetBeans, but in PhpStorm I don't know how to make them.

For example, to add console.log(); in NetBeans, I type con + space . con is the shortcut that I defined.

+69
webstorm phpstorm code-snippets code-completion
Mar 29 '12 at 5:08
source share
1 answer

In IntelliJ (Java IDE) or PhpStorm (PHP IDE) it is called Live Templates.

Go to Setting and start typing "live templates" in the search field. In the right pane, you can edit and create such templates.

So, in your case, you simply type "con" in the text box of the paragraph and "console.log ();" in the text area of ​​the template window below. You can even change with what actions you want to expand the template (default tab, space and input are possible).

The live theme of the template is much more complicated than what I wrote above. You can use variables and some contextual information. For further reading, I suggest the JetBrains / PhpStorm documentation.

+139
Mar 29 '12 at 5:18
source share



All Articles