Board logo

Subject: %ArgList% and %Arguments% don't work with current procedure [Print This Page]

Author: harghh    Time: 2008-11-7 06:28     Subject: %ArgList% and %Arguments% don't work with current procedure

Hi!

When I try to insert one of these macros while the cursor is INTO a procedure the parameters of the NEXT procedure are used. This is not a big problem, but annoying.

Example:

procedure TMyClass.Remove(const AID: Integer);
begin
  // using %ArgList% or %Arguments% here result in "Value" parameter
end;

procedure TMyClass.SetMode(const Value: Integer);
begin
  // ....
end;

Also it would be great if another macro exists (%CurrMethodName% ?) which is only the name of the method, without the name of the class. Ie 'SetMode' instead of 'TMyClass.SetMode'.

Thank you for your wonderful tools!

Harghh
Author: Passion    Time: 2008-11-7 23:40

The %ArgList% and %Arguments% means NEXT procedure's ones. We should add %CurrArgList% and %CurrArguments% to the macros, but it's not so easy due to our design limitation.

But we can add a %CurrMethodName% quickly for a method name without a classname.

The coming 0.8.9.459 nightly build version will contain this enhancement.

http://www.cnpack.org/downbuilds.php
Author: harghh    Time: 2008-11-8 21:28

Thank you for your reply and for adding %CurrMethodName%!

By curiosity, what make it difficult to implements %CurrArgList% and %CurrArguments%?
I would eventualy want to modify CnPack myself to add them but I need to understand how it work first.

Also, is there a workaround for "simulating" %CurrArgList% and %CurrArguments%?
For example a shorcut which will jump from the body of the procedure to BEFORE the procecure, use %CurrArgList%, and move generated text to the body of the procedure?
It may be something doable with Pascal Script.
What do you think?
Author: Passion    Time: 2008-11-11 20:05

We use mwPasLex to parse the pascal code. But it's not implemented or wrapped in Pascal Script due to Pascal Script's grammar limitation. So now in Pascal Script we can't parse the code as needed. We can only call some wrapped function in CnWizards.




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0