sourceinsight是一款很好的c语言的程序编辑器,方便对project管理,方便程序的阅读和编辑。查找功能使用十分频繁,选项较多,与其它软件的查找功能也类似,下面对英文版的查找功能,做简单说明:
查找参数:
whole wordsonly
casesensitive
projectwide
includesubdirectories
skip inactivecode
skipcomments
search onlycomments
我们最常用的一种查找方式是选择Search/Lookup References或按Ctrl+/组合键再或者鼠标点 R按钮,在弹出的Loopup References窗口进行查找操作。 在SearchMethod中有四种可选的查找方式:Simple String、Regular Expression、 KeywordExpression和Look Up Reference。其中SimpleString是最普通的查找方式,可以查找文件中出现的任意字符或字符,甚至可以查找 _upap || u这样的字符串,但是在工程较大时,查找过程会较慢。 RegularExpression查找方式将在后面讲述正则表达时会介绍到,这里暂时按下不表。 Keyword Expression和Look UpReference查找的结果基本相同,但是显示方式略有差异。这两种方式都是使用SI预先建立的数据库,查找起来速度相当快。但通常这种速度只对在查找标识符时有明显效果。对于像函数名,变量名等的查找,强烈建议使用这两种方式进行查找。
选择Search/Search Files或按Ctrl+Shift+F组合键,在弹出的Search Files窗口进行查找操作。在File Name框中可以填入文件名或文件夹。注意当要查询的文件夹双包含子文件夹时,可以勾选Options中的IncludeSubdirectiories,实现对各层文件的递归搜索。
选择Search/Search Project,在弹出的Search Project窗口进行查找操作。操作与LoopupReferences几乎完全一致,它们各自保存上次搜索的配置。
Lookup References Dialog box
The Lookup References command is very similar to the Search Projectcommand. In fact, each dialog box is identical. However, eachdialog box has its own persistent state.
Find References To
Type the symbol name you want to locate. The word under the cursoris automatically loaded into this text box. Source Insight will usethe context of the cursor position to determine the exact symbolinstance you want. If you invoked Lookup References from a symboldialog box or window, then Source Insight keeps the exact symbolreferences along with this text box.
Typically, you would type the name of an identifier in yourprogram, however you can type any string here and a project-widesearch will be performed. The search is very fast if you type asingle word only.
Search In
This drop-down list contains a list of document types. You can usethis list to restrict the search to only a particular type of file,or just the current file. If the Project Window is visible, thenyou can also use this list to specify the files selected in theProject Window.
Search Method
You can pick the search method to use from this list. There arefour different searching methods available:
•
•
•
•
Lines of Context
This only applies if you selected the Keyword Expression searchmethod. This specifies how closely, in number of lines, thekeywords must occur in order to qualify as amatch.
Find word variations
If enabled, Source Insight will also find different ending forms ofthe keywords you specified. For example, if you specified thekeyword “open”, Source Insight will also find “opens”, or “opened”,or “opening”. This option is only available for the KeywordExpression search method.
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 youchoose a different search method, this will restrict matches toonly whole words.
Skip Inactive Code
If enabled, then only code that is active under conditionalcompilation is searched. You must first specify known conditions inthe Preferences: Languages dialog box, in order for Source Insightto know what conditions are active or not. Conditional compilationonly 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 mutuallyexclusive with the Skip Comments option. The comment options slowthe search down a little.
Smart Reference Matching
This enables Source Insight’s smart reference matching feature.Source Insight will determine whether each reference found isactually referring to the symbol you are looking for.
The Smart Reference Matching option means that the search resultswill only contain references strictly to the exact symbol youspecified. For example, if you select a member of a struct and lookup its references, the search results will only contain referencesto that particular member of that particular struct – not just anystring that is equivalent. Note that this option slows the processdown because each same-string occurrence has to be qualified with asymbol 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 isuseful if you have a compile time dependency on an identifierusage. Just turn this on and search for references with thiscommand. The places where the identifier is referenced will be“touched” and your make program or development system willrecompile those files the next time you build your program.