SyncEdit for implementation/interface member parameters

When I am editing a method (procedure/function) of an object, I sometimes need to add a parameter or change some. Now in Delphi code, as you probably know, you often have to do that twice: once in the implementation, and once in the interface of the unit (and make sure it matches…).

The Change Parameters dialog – do you ever use it? Too cumbersome imo.

Of course you can use the change params refactoring (Ctrl+Shift+X), but personally I find it too cumbersome to use the dialog to change something that could much easier be typed. And did you notice that your cursor has to be on the method name, not the parameters that follow it, for the refactoring to even be enabled? Blegh. It just breaks my ‘flow’…

The language also allows you to skip the parameter declaration in the implementation, so you only have to change it in the interface, but to my taste this feels ‘unclean’ to do. I’d like to see the parameters declared above the code I am using them in. But that could be personal.

So most of the time, I just type my changes, use Ctrl+Shift+Up to go the interface, type them again, and go back down with Ctrl+Shift+Down. Or copy+paste it, to be sure I don’t make any mistakes.

What would really be nice in a future version of Delphi, is kind of a Sync Edit for procedure/function headers. Imagine this: Once your cursor is in between the parenthesis, you should be able to enable sync edit with a hot key, and then simultaneously change both declarations just by typing it. How about that?

Could this work? A mock up of sync edit for method headers in Delphi XE

 


Reacties

Eén reactie op “SyncEdit for implementation/interface member parameters”

  1. […] copies of the procedure/function prototype (Ctrl-Shift-Alt-P) is a really nice feature for which I have made a plea before. Now it is finally here! (Perhaps it was available in Castalia all along, but I haven’t used […]

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *