[Lazarus] RFC: Code tools Feature?

Michael Van Canneyt michael at freepascal.org
Thu Mar 27 09:22:21 CET 2014


Hi,

Is it possible to have the following in the code tools:

I would like to be able to specify a code snippet that is inserted at the start and end of a procedure
(after begin, before end keywords). The code snippet should contains some macros like $(CLASSNAME) $(METHODNAME).
Conceivably, other macros can be thought of: parameters, unit name etc.

The intended use is that the IDE generates stuff like

Procedure TMyClass.MyMethod;

begin
   {$IFDEF LOGPROCESSFLOW}Log('Entering TMyClass.MyMethod');{$ENDIF}

   {$ENDIF LOGPROCESSFLOW}Log('Exiting TMyClass.MyMethod');{$ENDIF}
end;

If I have specified as code snippets

{$IFDEF LOGPROCESSFLOW}Log('Entering $(CLASSNAME).$(METHODNAME)');{$ENDIF}

for the begin keyword, and for the end keyword:

{$IFDEF LOGPROCESSFLOW}Log('Exiting $(CLASSNAME).$(METHODNAME)');{$ENDIF}


Similarly, I'd like to be able to specify a code snippet to insert before/after the procedure header:

{ ----------------------------------------------------------------------
   AUTHOR: $AUTHOR
   PURPOSE:
   ARGUMENTS:
   RETURN VALUE:
   ---------------------------------------------------------------------}

(just an example)

Maybe some additional snippets can be imagined. I am specifically looking for the first one.

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 ?

Michael.




More information about the Lazarus mailing list