Editor - predefined templates for inserting

Are you missing a feature? Request its implementation here.
honyk
Posts: 176
Joined: Wed Apr 29, 2009 4:55 pm

Editor - predefined templates for inserting

Post by honyk »

Hello,

it would be nice to have possibility to specify custom templates (code fragments), which could be pasted similarly to other developer tools (Netbeans) - by writing short abbreviation (defined) and pressing Tab. For me it would be useful for identity transform in xslt templates. I use it very often but I still haven't remembered it yet.

Jan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Editor - predefined templates for inserting

Post by sorin_ristache »

Hello,

Code templates (both built-in ones and user defined ones) are available and can be inserted using the content completion window. You define custom templates in Preferences -> Editor -> Templates -> Code Templates.

You insert a code template in the same way as inserting XML elements and attributes with content completion: you type a prefix of the name of the prefix and Ctrl-Space displays all the templates with that prefix. The XSLT identity transform template has the name ct (the copy template).


Regards,
Sorin
honyk
Posts: 176
Joined: Wed Apr 29, 2009 4:55 pm

Re: Editor - predefined templates for inserting

Post by honyk »

Wow, I wasn't aware of it! Excellent functionality, as usual. Thanks for quick response.
ra0543
Posts: 80
Joined: Wed Jan 14, 2009 12:50 pm

Re: Editor - predefined templates for inserting

Post by ra0543 »

Is this functionality available in Author view? If not, can the option to insert arbitrary user-defined code templates in Author view be added to a forthcoming release?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Editor - predefined templates for inserting

Post by sorin_ristache »

Hello,

In Author mode you insert a custom code template that are different than the elements inserted by content completion or by double click in Elements view with a custom extension action that you configure in the document type for your Author document. Custom extension actions are created based on the Author API published in the Author SDK (which includes also many examples of source code of Author actions) and are configured in the document type in Preferences -> Document Type Association.


Regards,
Sorin
Post Reply