NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Code Template enhancement


Joined: 03 Mar 2004
Posts: 40
Reply with quote
Having worked with PHPed for a few months now, I'm missing the smart code templates from ZS and it would be great if there were something like that in PHPed.

Basically I'm missing the ability to...
    specify variables in the templates that can be reused elsewhere in the template (filling in the first instance fills in all of the rest)
    specify variables that insert data from the current coding environment (like the date, time, file name, current method name, current class name)
And then when using a template...
    have the variable name displayed in the code as a hint to what the information variable should contain
    have the cursor jump to the next variable when I press tab or enter
    be able to specify the end point for the cursor after the template variables

I don't miss these features a lot when I use templates in the code, but I miss them a _lot_ in doc blocks.
View user's profileFind all posts by jonphippsSend private message
Yes!


Joined: 31 Jul 2005
Posts: 16
Reply with quote
This would be great. I've written a macro for this in MSVC, but I'm missing the feature in PHPEd, which is a pity, as the templates are otherwise working very, very smoothly in PHPEd.

I'd recommend supporting a macro system with both functions and variables, such as in this file header template. Also, using dollar signs for macros would be a bad idea, as they occur so often in PHP and Perl code. Using the wiki-style double square brackets would probably be a safer bet.:
Code:
/**
 * @file [[relativePath(filename)]]
 *
 * |
 *
 * @copyright (c)[[format("YYYY", date)]] Foo inc. All rights reserved.
 * @author [[user]]
 */

Even though the functions would be nice, just supporting simple variables, like "[[user]]" would be very useful; this would also be extendable at a later stage.

(Supporting some standard embeddable language within the brackets would of course be a great benefit, but I'd recommend putting that in as part of a more general macro/plugin feature.)

_________________
jorgen*fabeljet,com
View user's profileFind all posts by j0rg3nSend private messageVisit poster's website


Joined: 05 Jan 2005
Posts: 16
Location: Austria
Reply with quote
Additionally it would be very nice to be able to sort the code templates. At the moment they appear in the order of creation iirc. At least sorting alphabetically would help finding your code templates quicker while writing code, especially when you organize them by "groupname - templatename".

Btw: in the template editor dialog, the templates are ordered alphabetically!

Another nice feature would be an extended template code editor. The existing one doesn't allow tabs and is pretty small. syntax highlighting would be quiet nice too, but not that essential Wink

Just an idea: writing templates could be embedded inside the standard editor by using a toolbar or an adjusted new/load/save.

Thanks for such a nice product and the best support I have ever noticed!

Yours,
mat
View user's profileFind all posts by matSend private messageVisit poster's website
Code Template enhancement
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic