Snippets with tab completion?

Hi,

does PhpStorm support code snippets that can be accessed via <tab>?

A small example from Sublime Text 2:

<snippet>
     <description>Case Expression</description>
     <content><![CDATA[if(${1:condition}) {
     ${2://statement(s)}
}
elseif(${3:condition}) {
     ${4://statement(s)}
}
else {
     ${5://statement(s)}
}
$0]]></content>
     <tabTrigger>ifelseif</tabTrigger>
     <scope>source.xys</scope>
</snippet>



After entering "if" the code completion of ST 2 allows to autocomplete it to "ifelseif" which will insert everything from "if(${1:condition})" to "}$0" into the editor.

$0 - $5 are the variable positions ($0 = exit position) which are accessible via tab instead of using the cursor keys to have to go to each part of the structure in there.

"${1:condition}" will highlight the text after the ":" when you switch to it via tab.

I've attached a small screenshot where I used <tab> two times to get to the second //statement(s) entry.

Is something like this possible in PhpStorm atm?

Tia,
Highend

Attachment(s):
Unbenannt.png
2 comments
Comment actions Permalink

Thanks Andriy,

that's the thing I was looking for :)

Regards,
Highend

0

Please sign in to leave a comment.