Smart Rename

Smart Rename will rename a symbol. If the Smart Reference Matching option is enabled, then Smart Rename will rename the symbol only in the correct scope contexts. It can rename a symbol across all project files. It can be used to rename function local variables, class or struct member, and functions.

Smart Rename is a specialized form of a global search & replace. Source Insight uses its symbol database index to make it very fast.

Old Name

Add the name of the identifier to be renamed. The word under the cursor is automatically loaded for you. The position of the cursor is significant because Source Insight will determine exactly which symbol you want to rename, based on the local scope context.

You can add any string into this text box; however, the rename operation is optimized and much faster for single-word strings. Also, if you type anything into this text box, Source Insight will have to re-establish exactly what symbol you are trying to rename, based on the initial cursor position.

If you are renaming a member variable, or a local variable, you will notice that the Old Name text box contains the full symbol name, including the container symbols. For example, it might say “DocDraw.paintStruc”, where “DocDraw” is a function name, and “paintStruc” is a local variable. In a sense, “paintStruc” is a member of the “DocDraw” function.

New Name

Add the new name here. For members, you should only add the new member name, and omit the symbol container qualifiers.

Output Search Results

If checked, then the results of the search will be output to the Search Results window. This provides you with a log of changes made to each occurrence. The Search Results window will list the text the way it was before the replacement with the New Name string.

Confirm Each Replacement

If checked, Source Insight will confirm each replacement by prompting you.

Confirm Each File

If checked, Source Insight will confirm each modified file by prompting you.

Smart Reference Matching

This tells Source Insight to use its language information, and the cursor scope context to determine exactly what symbol is being renamed, and to make sure it only renames strict references to it.

Skip Inactive Code

If enabled, then only code that is active under conditional compilation is searched. You must first specify known conditions in the Preferences: Languages dialog box, in order for Source Insight to know what conditions are active or not. Conditional compilation only applies to some languages.

Skip Comments

If enabled, then symbol references inside comments will not be renamed.

Include Read-Only Files (keep buffers open)

If checked, then replacements will be made inside of read-only file buffers. Source Insight will not attempt to save the file as the replacement operation progresses. The files will be left open and modified, allowing you to save the files yourself. If not checked, then read-only files will be skipped. Note that this options works independently from the Preferences: Files option Allow editing read-only file buffers.

You can make Source Insight automatically save over read-only files while renaming if you enable the Preferences: Files option: Save over read-only files without prompting.