"Code" vs. "Live" templates? using "Code" and "Include" templates?

The "File and Code Templates" dialog has tabs for 'Templates', 'Includes' and 'Code' templates.  I understand the 'Templates' tab contains file templates and know how to use them.  But how are templates from the 'Includes" and 'Code' tabs used?  I understand how to manage and use 'Live' templates for injecting code, so am wondering what/how 'Code' templates are used and how they are different?  Are they a legacy feature that has been replaced by 'Live' templates, and is that why you cannot create new 'Code' templates?  Thanks.

5 comments
Comment actions Permalink

Hi there,

No -- they are not legacy.

They are used in certain places when autogenerating PHPDoc comments or methods (implementing from interface / overriding from parent) etc.

Since they are used in specific places, IDE has to know about them -- that's why you cannot create your own (what's the point: they will be just there and you will not be able to use them)

0
Comment actions Permalink

Thanks Andriy.  And what about the 'Includes' templates?

0
Comment actions Permalink
And what about the 'Includes' templates?

Same story.

Which IDE are you using: PhpStorm or WebStorm? I guess WebStorm (which may not have much (if anything) in there).

These screenshots should tell everything:
screen01.png

screen02.png

0
Comment actions Permalink

Using PhpStorm.  re: "same story" - ok, but then how would I reference the code/include templates in a new file template?  i.e. if I can create new "Include" templates, how are they referenced?

EDIT: wait, I see now that the #parse directive can be used to pull in "Include" templates.  But how about "Code" templates - e.g. if I want to create a Php setter method, how would I pull in the "PHP Setter Method" code template?

0
Comment actions Permalink

Code templates are used by IDE directly.

Your "PHP Setter Method" code template will be used when IDE is creating a setter for some property.

0

Please sign in to leave a comment.