Using Sync Edit

From RAD Studio
Jump to: navigation, search

Go Up to Refactoring Procedures 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:

  1. In the Code Editor, select a block of code that contains identical identifiers.
  2. Click the Sync Edit Mode icon SyncEdit icon that appears in the left gutter, or press Shift+Ctrl+J.
    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.
  3. 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.
  4. 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 (see Refactoring Applications Index).

See Also