On Thu, 27 Mar 2014 09:22:21 +0100 (CET)
Michael Van Canneyt <mich...@freepascal.org> wrote:

>[...]
> I would like to be able to specify a code snippet that is inserted at the 
> start and end of a procedure
>[...]
> Similarly, I'd like to be able to specify a code snippet to insert 
> before/after the procedure header:
>[...]
> Additionally (and quite importantly) this behaviour should be easily toggled 
> on/off,
> without having to empty the templates.
> 
> Maybe such a thing already exists, but I have not been able to locate it ?

There are several such things. They need some work to make them
more comfortable though:

1.
You can add code templates (Ctrl-j). For example for the
method start 
go to Tools / Code templates, 
then add a new one, 
give it a name, e.g. 'pb' and a description 'procedure begin',
click "enable macros"
And as source:
{$IFDEF LOGPROCESSFLOW}Log('Entering $ProcedureName()');{$ENDIF}
Click ok to save and close dialog.

Move cursor behind the "begin" and type pb and Ctrl+j.


2.
I wrote a small command line utility for Graeme that can add/remove code
to starts/ends of procedures. He needed it for profiling.
The tool is here:
components/codetools/examples/addfpprofcalls.lpi
It is merely a demo, but maybe someone wants to write a dialog
and/or IDE package.


3.
Donald Ziesig added templates to the IDE to configure some parts of
class completion. You can try it by compiling Lazarus with
-dEnableCodeCompleteTemplates. Then you should see new options on the
code creation page. I had not the time yet to finish it.


Mattias

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to