Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-03

codetools trying to keep track of renamed procedures

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Friebe

Codetools has a feature, that tries to keep track of renamed or altered declaration of procedures.

If you change the name of a procedure inside the object declaration, and then press code-completion => Codetools will see the old method in the implementation.. It will detect that the old method no longer has a declaration, and assume it must have been renamed. It changes the old implementation to match the new declaration

type
  TA = Class
  public
    //Procedure bar(a: Integer);
    procedure foo; virtual;
  end;
implementation
procedure TA.bar(a: Integer);
begin
end;

In this example TA.bar will be updated to TA.foo.

It would be create if it was possible to disable this feature. (I'll bring it up for discussion here, before filing a feature request)

Personally I think this doubles the refactor/"rename identifier" tool. And I had several occasions where this feature did more harm than use.

For example when I extract parts of a class, into another class, I have to remove a lot of methods and introduce some new ones. (For the new ones I use code-completion)
Without this function, if I forget the body of an old/removed method, the compiler gives a warning.
With it, code tools has renamed the "not-deleted-implementation" to one of the new methods; and I spend valuable time to find out where that code comes from.

Best Regards
Martin

Reply by email