Is a code snippet library coming soon?

Hi Just wondering if there is any new on including a code snippet library. I have a lot fo code snippets of my own I want to add but currently there is jno way fo doing this

9 comments
Comment actions Permalink

I'd love to see a snippet capability too. I tried the eSnippet Pro plugin, but I want the ability to easily maintain my own "library" of snippets. This would be a great addition to PhpStorm.

0
Comment actions Permalink

Yeah I tried E-snippet 2 but it isnt working very well. or rather i have not gotten it to work

0
Comment actions Permalink

I think phpStorm has something better than a snippet library. (Live Templates)

Assign your snippet a tag and away you go, nice short cut and everything.
Its one of my favorite tools in phpStorm.

0
Comment actions Permalink

I Have no idea how to sue live templates or what they are for can you explaine a bit

0
Comment actions Permalink

Select and copy your code snippet.

Go to File -> Settings -> Live templates
Click the + button to add one
Make the abbreviation your short cut text.
Paste your snippet in the textarea
Pick the context (phpStorm EAP 3*) is the Define link on the bottom.

Apply

Now when coding under the context you picked you can type your abbreviation and hit tab or enter or what ever the expand selection you picked was.
This will insert your snippet.

You  can also have placeholder vars.
They are defined like $var$
This creates a tab stop in your snippet..

0
Comment actions Permalink

I qq'ed about the lack of snippets in PHPStorm for months until I discovered Live Templates. Try it.

0
Comment actions Permalink

Jeff: Thanks! I've tried it and it looks great. It would be nice to have a Tool window to list them, but that is just to help my bad memory...   ---Jim

0
Comment actions Permalink

Code|Insert Live template (Ctrl+J) will help you. Type to narrow abbreviation list down, look at descriptions!

0

Please sign in to leave a comment.