Using Sync Edit
Go Up to Refactoring Applications Index
New video for 2010! Video: Sync Editing in RAD Studio 2010, by Mike Rozlog
The Sync Edit feature lets you simultaneously edit identical identifiers in selected code. For example, in a procedure that contains three occurrences of label1, you can edit just the first occurrence and all the other occurrences will change automatically.
To use Sync Edit:
- In the Code Editor, select a block of code that contains identical identifiers.
- Click the Sync Edit Mode icon that appears in the left gutter. The first identical identifier is highlighted and the others are outlined. The cursor is positioned on the first identifier. If the code contains multiple sets of identical identifiers, you can press TAB to move between each identifier in the selection.
- Begin editing the first identifier. As you change the identifier, the same change is performed automatically on the other identifiers. By default, the identifier is replaced. To change the identifier without replacing it, use the arrow keys before you begin typing.
- When you have finished changing the identifiers, you can exit Sync Edit mode by clicking the Sync Edit Mode icon, or by pressing the Esc key.
Note: Sync Edit determines identical 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.