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

 

Advertenties

Over Shiftkey
I am Maarten, owner of and chief software developer for Shiftkey software development from The Netherlands. I will be writing mainly about things I run into when programming in C# or Delphi.

One Response to SyncEdit for implementation/interface member parameters

  1. Pingback: Work faster in Delphi XE8 by using Castalia’s keyboard shortcuts | Shiftkey Software Blog

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s

%d bloggers liken dit: