Live Templates - more than 1 file possible?

Hi everyone,

does somebody have an idea, if PhpStrom allows to enter code snippets as Live Templates which consist of more than 1 file?

Just to give a better idea of what I'm trying to do: I develop with Magento E-Commerce framework and often have recurring tasks which are a bit more complex than just to insert a code snippet in one place. If you, say, want to rewrite a Magento model, you need to add some piece of code to an XML configuration file AND also add some code to the PHP file with a new model. This is a rather easy example, sometimes one needs to add code to far more than 2 places.

I tried to use the live templates as they are, but they are very context-relevant (e.g. one template is for XML and one is for PHP), so that I'm often not sure, if I really added the code to all places I had to to make it work.

Is there any possibility to add to multiple files and places using just one live template?

An idea I also already thought of could be to use an external code snippet management tool (e.g. http://shpakovski.com/codebox/). It is actually able to store multiple code pieces in one snippet. But there are unfortunately other drawbacks (extra OSX only software, proprietary snippet storing format, lacking export possibilities, much time since last update etc.)

Does someone maybe have a better idea how to handle this?


Thanks a lot for your comments and kind regards,
Dimitri

3 comments
Comment actions Permalink

Hi there,

Is there any possibility to add to multiple files and places using just one live template?

It's not possible with Live Templates.

0
Comment actions Permalink

Hi Andriy,

OK, thank you for the answer. It's a pity, of course.

Do you have an idea, if there is a plugin or something to extend this functionality? Or is there perhaps a similar functionality on the roadmap for the next version or so?
I could imagine, that this requirement may actually be not that rare or special...


Thanks and kind regards,
Dimitri

0
Comment actions Permalink

I'm not aware of such plugins.

Even if they would -- it must be more project/language/framework specific as inserting multiple (and different) chunks of code into different files (that template itself has no clue about) is impossible without parsing those files and understanding their structure (especially if that would affect files of different types/languages). I'm not saying that it's not possible to create such plugin .. but it would be quite a task.

Therefore even if such functionality exists in some plugin (specific to that framework or technology) it will be doing some rather predefined code manipulations.

If the code you are generating is quite common .. then I may suggest to file a ticket to the plugin that already exists/supports your technology/framework (Magicento plugin?). Other than that -- feel free to file Feature Request ticket at Issue Tracker where devs may either accept it or redirect you to already existing ticket or possible workaround (if it exist, of course). Having code samples of what sort of code you are planning to insert and what files will be very handy (to see if any workarounds can be applied and other estimations)

0

Please sign in to leave a comment.