Hello,
I have a few points related to Code Templates, which are a great feature, but don't quite seem to do everything they could.
1) The built-in template functions like #date# and #time# don't get expanded with completion insight:
- Given a template id 'cm' and a template value '-- #date# #time#'
- If I type 'cm' in a worksheet (without the quotes obviously) and invoke completion insight - the output is '-- #date# #time#'
- If I type 'cm' in a worksheet (without the quotes obviously) and invoke code template from the context menu - the output is '-- 22/02/14 10:51:36'
Is there a way to have completion insight evaluate the functions wrapped in the # tags?
2) Is there a way to nest templates? As a very simple example:
- Given a template id 'ca' and a template value 'Author : '
- I would like to be able to write another template id 'cm' and a template value '-- #ca#'', which when invoked would give the output '-- Author : '
3) Is there a way to extend the built-in template functions like #date# and #time#, to reference and evaluate Oracle built-in functions? As an example:
- Given a template id 'ca' and a template value '-- Author : #sys_context('USEREVNV', 'OS_USER')#'
- I would like to be able to invoke the template and get the output '-- Author : <current_os_user>'
- Another example would be 'cd' and a template value '-- Date : #sysdate#'
- I would like to be able to invoke the template and get the output '-- Date : <the current date formatted to the current NLS settings>'
Although the examples I have given are simple, this is a very powerful feature.
4) Is there a way to provide user input to code templates at invocation time? As an example:
- Given a template id 'pp' and a template value 'procedure &pname is begin null; end &pname;'
- I would like to be able to invoke the template and get prompted for an input value for pname.
- This input should be used to replace all occurrences of &pname in my template value
- In this example, for an input value of 'my_proc' I would expect the output 'procedure my_proc is begin null; end my_proc;'
Again this is a simple example, but also a very powerful feature.