Friday, December 08, 2006

Don't mistake SyncEdit for Refactoring ;-)

Don't mistake Delphi's SyncEdit for Refactoring. (In case you wonder what SyncEdit is, it's invoked by pressing Ctrl+Shift+J on a selected text in the editor. Works in Delphi 2005 and higher.)

By doing so I've just introduced a rather obscure bug in my code which took me a while to recognize. ;-)
When using SyncEdit, be aware that you're simply doing a search/replace within the selected block of code.

The help says:
Sync Edit determines indentical identifiers by matching text strings; it does not analyze the identifiers. For example, it does not distinguish between two like-named identifiers of different types in different scopes. Therefore, Sync Edit is intended for small sections of code, such as a single method or a page of text. For changing larger sections of code, consider using refactoring.

There's also a nice article by Bob Swart about SyncEdit, Refactoring and more.
Post a Comment