Smart Rename

Smart Rename will rename a symbol, including its definition and usages, across all project files or within a local function. If the Smart Reference Matching option is enabled, then Smart Rename will rename the sym­bol only in the correct contexts. 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 con­tains 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 mem­ber 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 enabled, 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 enabled, Source Insight will confirm each replacement by prompting you.

Confirm Each File

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

Smart Reference Matching

This tells Source Insight to use its language information, and the 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 condi­tions 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 enabled, 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 enabled, 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 Prefer­ences: Files option: Save over read-only files without prompting.