Lookup References

The Lookup References command searches the current project for references to a selected symbol. For exam­ple, click inside "BeginPaint", run the Lookup References command, and Source Insight will open a Search Results window, which lists all the places that reference "BeginPaint" in your project.

Source Insight uses its symbol indexes to make the searching fast.

References can be found in all source code text, including comments, and potentially inactive #ifdef branches. However, you can control whether these places are searched or not.

The Search Project command is the same as Lookup References, but with different option state. See: Search Project.

Lookup References Dialog box

The Lookup References command is very similar to the Search Project command. In fact, each dialog box is identical. However, each dialog box has its own persistent state.

inset_73.jpg

 

Find References To

Type the symbol name you want to locate. The word under the cursor is automatically loaded into this text box. Source Insight will use the context of the cursor position to determine the exact symbol instance you want. If you invoked Lookup References from a symbol dialog box or window, then Source Insight keeps the exact symbol references along with this text box.

Typically, you would type the name of an identifier in your program, however you can type any string here and a project-wide search will be performed. The search is very fast if you type a single word only.

Search In

This drop-down list contains a list of file types. You can use this list to restrict the search to only a particular type of file, or just the current file. If the Project Window is visible, then you can also use this list to specify the files selected in the Project Window.

Search Method

You can pick the search method to use from this list. There are four different searching methods available:

Lines of Context

This only applies if you selected the Keyword Expression search method. This specifies how closely, in num­ber of lines, the keywords must occur in order to qualify as a match. See: Keyword Expressions.

Find word variations

If enabled, Source Insight will also find different ending forms of the keywords you specified. For example, if you specified the keyword "open", Source Insight will also find "opens", or "opened", or "opening". This option is only available for the Keyword Expression search method.

Include in Results...

Click this button to specify what information is included in the Search Results.

Search Options

Case Sensitive

Specifies whether the search is case sensitive or not.

Whole Words Only

For the Lookup References mode, this option is always on. If you choose a different search method, this will restrict matches to only whole words.

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 comments will not be searched.

Search Only Comments

If enabled, then only comments will be searched. This is mutually exclusive with the Skip Comments option. The comment options slow the search down a little.

Smart Reference Matching

This enables Source Insight's smart reference matching feature. Source Insight will determine whether each reference found is actually referring to the symbol you are looking for.

Matching exact references slows the reference finding process.

The Smart Reference Matching option means that the search results will only contain references strictly to the exact symbol you specified. For example, if you select a member of a struct and look up its references, the search results will only contain references to that particular member of that particular struct – not just any string that is equivalent. Note that this option slows the process down because each same-string occurrence has to be qualified with a symbol lookup.

Touch files and cause recompile. Turn this on to cause each file's "last modified" time stamp to be set to the current time. This is useful if you have a compile time dependency on an identifier usage. Just turn this on and search for references with this command. The places where the identifier is referenced will be "touched" and your make program or development system will recompile those files the next time you build your pro­gram.

Keyword Expressions

A keyword expression search is similar to an Internet search engine query. Source Insight searches the proj­ect for occurrences of a set of keywords that appear within a specified number of lines. The Lines of Context text box indicates the maximum distance the keyword terms can be from each other to qualify as a match.

For example, if you typed "cat food", then Source Insight will search for occurrences of "cat" and "food" within X lines of each other.

There is an implicit logical-AND operator between keywords. That is, if you type more than one keyword, the both keywords must be present to qualify as a match. You can include other Boolean operations as well. The following table lists the operators available:

Table 4.4: Keyword Search Operators

Operator

Example

Action

AND or +

cat and dog

Both terms must be present.

OR

cat or dog

Either term must be present

NOT
or –
or !

-cat

The term must not be present

=

=Betty

Case sensitive match

? "regexp"

? "^Ich"

Term is a regular expression

You can also group expressions using parentheses. For example:

(cat or kitty) and food

(file or buffer) and (save or write) and !error

Keyword Variations

If you enabled the Find word variations option, then Source Insight will also find different ending forms of the keywords you specified. For example, if you specified the keyword "open", Source Insight will also find "opens", "opened", and "opening". This has the same effect as typing this expression:

(open or opens or opening)

Word variations are applied to each keyword term. For example, if you specified:

save write

Which implies "save" and "write" must be present. With word variations enabled, this search would be equiv­alent to:

(save or saves or saving) and (write or writes or writing)

Keyword Search Results

When you perform a keyword search, the Search Results will list blocks of lines that include the keywords together.   This gives you a little bit of context around the matches.