Show: Delphi C++
Display Preferences

SyncEdit (IDE Tutorial)

From RAD Studio
Jump to: navigation, search

Go Up to The Code Editor Index (IDE Tutorial)


The SyncEdit feature lets you simultaneously edit identical identifiers in the code.

As you change the first identifier, the same change is performed automatically on the other identifiers. For example, in a procedure that contains several occurrences of the variable TextStatus, you can edit only the first occurrence and all the other occurrences will change automatically.

To use SyncEdit:

1. In the Code Editor, select a block of code that contains identical identifiers.

TutorialIDEFig2-22.png

Figure 2-22. Highlighting all the occurrences of an identifier in a section of code


2. Click the SyncEdit Mode icon SyncEditIcon.png that appears in the left gutter, i.e., the column to the left of the code window. 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 SyncEdit Mode icon, or by pressing the Esc key.

Note: SyncEdit 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, SyncEdit is intended for

small sections of code, such as a single method or a page of text. For changing larger portions of code, consider using refactoring, which is a more advanced method of improving your code, without changing its functionality. Further details on refactoring are given in Refactoring.

For more information on using SyncEdit, see the video Video: Sync Editing in RAD Studio 2010, by Mike Rozlog.

Next

Code Insight

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance