[SourceInsight] .source insight tips

Transfer: https://www.veryarm.com/140428.html

1   appetizer - Primary applications

1.1   Select interface to enjoy the beautiful work

Although we can not judge by appearances, but it seems no one has ever blamed their appearance software. SI gorgeous interface, fully consistent with the modern
aesthetic taste of people's fast-paced world. In the SI, we can easily put the keyword types, variables, flags, functions, macros, and other annotation is defined as a different color and display mode (normal or italic, bold or are
normally, underlined, magnified etc.), there is always a way to allow us to tell at a glance what the logo yes.

1.1.1   Font Selection

Styles can be inherited in the SI, if fundamentally change the font, the easiest way is to directly modify the root style of the font,
because the other style will thus inherited. Select Font Options in the Options / Document Options page of Screen
Fonts font, you can change the font style roots. The default configuration for the SI Verdana font, is a non-monospaced font, in order to write code to have good look at the various editors
Qi effect, it is strongly recommended to use a monospaced font, Courier, New Courier and Times New Roman are all good choices.

1.1.2   Color Definition

After all, this is a matter of opinion, so there is never a unified standard. A lot of people do not like the default configuration to provide SI, then we
will change it. Select Options / Style Properties page, you can modify all the styles in it. Select the equal sign (=) indicates inherited the Parent
Style, of Pick can select (or ON / OFF, etc.) to configure a new value. It all depends on personal preference.

1.1.3   identifiers style selection

With  custom colors  to complete this configuration within the same interface one.

1.1.4   background color selection

In the hope to change the background color of the window click the right mouse button (assuming a right-handed mouse), select the context menu of xxx
Window the Properties item, then click on the pop-up window of the Back
Color button, you can modify the window background color. Source for the main window of the SI, simply select a context menu item Special Window Color background color to complete the modification.

 

 

1.2   Configuration sensible defaults work efficiently

 

 

1.2.1   use reasonable indentation

I always think the most likely to gain recognition is to configure the options on this. Select
Options / Document Options page, click on it in the Auto Indent button in the pop-Auto
indenting window, by default Auto Indent Type selecting Smart, and check the Smart Indent configured to
Options two options, so the resulting default indent effect

    while (1)
        {
        I
        }

 

Every time to adjust it manually retracted, in fact, as long as the two option to remove the hook, you can get

    while (1)
    {
        I
    }

why not?

1.2.2   display coordinates

Normally the status bar at the bottom left of the window, displays the most current cursor ranks of information, but I always feel is not obvious, so usually we make the following configuration: 
Select Options / Document Options page, check off the Show line numbers. At the same time check one Show right margin, we can show a right border, ready to remind us whether that line of code written in too long.

1.3   to create convenient shortcuts happy work

1.3.1   a few more commonly used shortcuts

By default, SI has defined a number of very useful shortcuts:

  • F5
    specified line number, jump the line to achieve, in the face of compilation errors, in particular, can easily find the offending line.
  • Shift + F8
    to highlight the use of specified identity, a quick identification.
  • Ctrl + mouse click on the logo
    to jump directly to the definition of the identity.
  • Ctrl + F
    to find in this document.
  • F3
    This document is the result of a lookup on.
  • F4
    This file search results next.
  • F7
    to open the Browse Project Symbols window, a quick engineering within the definition of identity.
  • Ctrl + M
    to create or find the bookmark next time to get back to this position.

1.3.2   custom shortcut key

Select Options / Key Assignments, in the pop-up window Key Assignments can add your favorite shortcuts freedom. Compare the following recommended several shortcuts defined:

  • Edit: Drag Line Down
    cursor to the current line down.
  • Edit: Drag Line Up
    cursor current line down.
  • Edit: Join Lines
    current line and the next line from the previous line.

1.3.3   More shortcuts

If you happen to have research on SI's Marco language (we'll describe below), you can also define more useful shortcuts, such as adding headers, function header, comments, etc. (hereinafter Introducing Marco language will explain how to achieve) .

2   tips - Intermediate Applications

2.1   Find and Replace

Find and supports a variety of alternatives in the SI, in addition to look in the paper mentioned above, but also find support within the scope of the project, directory lookup, specify multiple file search and so on.

2.1.1   Find

  1. Loopup References
    most commonly used way is to select a lookup Search / Lookup References or press Ctrl + / re-key combination or mouse button R, the pop-up window Loopup References lookup operation. 
    There are four alternative ways to find the Search Method: the Simple String, Regular Expression,
    Keyword Expression and Look Up Reference. Where the Simple
    String is the most common way to find any character or characters can find files that appear even find  _upap || u  such strings, but when the project is large, the search process will be slower. 
    Regular Expression search methods will be described in later will be introduced to, here temporarily refrain when a regular expression. 
    Keyword Expression and Look Up
    results Reference look basically the same, but slightly different display. Both methods are using pre-built database SI, find them very fast. But this rate is usually only find in
    a significant effect identifier. Look like for the function name, variable names, etc., it is strongly recommended to use these two methods to find out.
  2. Search Files
    selected Search / Search Files or press Ctrl + Shift + F key combination, the pop-up window Search Files lookup operation. 
    In the File Name box you can fill in the file name or folder. Note that when the file to query folder contains subfolders double, you can check the Include Subdirectiories Options are to achieve recursive search for the file layers.
  3. Search Project
    selection Search / Search Project, the pop-up window Search Project lookup operation. Operation and Loopup References almost exactly the same, they each save the configuration of your last search.

2.1.2   Replace

  1. Alternatively a single file
    selection Search / Replace or press Ctrl + H key combination, the pop-up window Replace lookup operation. In the Search item in the hook
    selected Selection is only for currently selected section of the document to be replaced. Also, if you check Confirm The
    Replacements are one by one to confirm the replacement, otherwise it will replace all content meets the replacement condition at the same time.
  2. Alternatively multiple file
    selection Search / Replace Files or press Ctrl + Shift + H key combination, the pop-up window Replace Files lookup operation. In addition to increasing New box (contents after replacement), the rest were the same window Search Files may be described with reference to find the portion of the operation.

2.2   column operations

Although it is said that the opening, SI column operation function is relatively weak, but does not mean no. To press the Alt key, and then select the column can be carried out with the mouse, and then can delete the specified column.

2.3   anonymous tips

Here are some tips, in most cases we can ignore their existence. But if we know that, sometimes, it can effectively improve work efficiency.

  • Smart Rename
    vertically selected Smart Rename File menu or press Ctrl + 'key combination Smart Rename pop-up window. It has very powerful features, but the most convenient way is to use the names of local variables within a function change, it will only work inside the function, very fast.
  • Renumber
    using Ctrl + R Renumber window will pop-up, where the order for processing digital quite effective, such as array subscripts. Existing code e.g.
        array[0] = 1;
        array[1] = 2;
        array[2] = 3;

    Now changed

        array[0] = 0;
        array[1] = 1;
        array[2] = 2;
        array[3] = 3;

    Of course, one can modify, but the quickest way is to array [0] = 1; before adding Array [0] = 0; , then the column gate array subscript, Renumber function used to refill the value 0 to the start value.

  • Edit Condition
    lot of code, especially the driver code, of which there are a large number of pre-compiled definitions to implement support for different hardware configurations. In reading such a code is the code most painful branch can not simply judge the actual implementation of the program. At the same time there is a large number of branches, often confuse our audiovisual. For example, the following code:
        the DEV1 #ifdef
             / * the DEV1 Code Code * / 
        #else 
            / * other device to execute code * / 
        #endif

    If it is determined that our current analysis of the implementation of DEV1  5 , you can select Edit Condition and down the File menu option in the pop-up window Conditional Parsing the value DEV1 is True, then the  #ifdef DEV1 is equivalent to #if 1 a considerable commented out #else branch code. Conversely, when the set Flase, comment out #ifdef DEV1 branching code.

3   learn to be lazy - Advanced Applications

4   APPENDIX 1-SI regular expression in

Since the find and replace, often with the use of regular expressions 6 , where SI is a positive expression of a brief introduction.

4.1   Tsuhaifu

Total regular expression wildcards table:

Character Matches
^  (At the beginning of the expression) The beginning of the line
. Any single character
[abc] Any single character belonging to the set of abc
[^abc] A single character set does not belong to any of abc
* Preceding character zero or more repeat
+ Preceding a character or more repeat
t A tab character
s A space character
w A blank character (including the tab character and spaces)
$ End of the line

4.2   expression group

When performing replacement operations, the group will come in handy. Parts of the regular expression can be used ( and ) separated, each partition is a group obtained. During replacement may be drawn through a set of specific content from the matching string. Expressions Each group has a positive number, numbered from left to right starting with 1. 
For example: ABC (of XYX) will match abcxyz, group 1 contains the case xyz string. When the replacement operation is performed, it is possible to replace the contents by filling in the box 1 is taken out of the string. By extension, may be used <number> to obtain groups <number> string included. 
For example: when the set (abc) (xyz) replaced 21 is when replacing rules for abcxyz string is replaced, the group contains 1 ABC, XYZ group comprising 2, and the content is defined after the replacement group 2 group 1 followed SUMMARY content ( 21 ), thus resulting xyzabc. 
For the use of real example, I believe it will increase everyone's interest. Sometimes facilitate debugging, code wandered around in various forms mytrace call

   
mytrace("Create parameter list... ");

Sometimes I wish them all commented out, and sometimes they want to recover all of them back. This is a simple example, you can use

^(.*)(/*)(.*mytrace.*)(*/)___FCKpd___6nbsp;==> 13

Restore them back, and use

^(.*)(mytrace)(.*)___FCKpd___7nbsp;==> 1/*23*/

The completion of all of them commented.

5   Appendix 2-SI in the macro language

I still think this is the most interesting part of the SI, which is a powerful programming language, you can achieve almost possible to use various functions in the programming process. 
Here we are not ready for how practical macro programming language for the presentation (see SI can help documentation.), Explains how to use already programmed. For your convenience, I have placed these programs are focused on utils.em file, this file is discussed below. 
The macro file in the encoding process to achieve a number of functions may be used, such as adding a header, described function (to automatically add the file name used when the function name and the current date) and macro definitions, code completion congruent. 
Instructions for use:

  1. Project / Open Project ...
    Open Base Project (the project generally in the "My Documents / Source Insight / Projects / Base" in);
  2. Project / Add and Remove Project Files ...
    join macro files (ie utils.em);
  3. Options / Menu Assignments
    Open Menu Assignments window, enter the Command Macro, select the macro you want to use, add to the appropriate menu.

Recommended macros: InsFileHeader, InsFunHeader, InsHeaderDef, InsIfdef and AutoExpand (the code auto-completion, it is recommended to build shortcuts). 
AutoExpand on the way of example, if you enter a switch back and the cursor is in the switch, it will run the macro to give

    switch (###)
    {
    case
        break;
    default:
    } 

For InsFunHeader macro, if the function thereof as follows

    int nOpenConfigFile(char *pchMemConfig, char *pchFlashConfig,
        int nSize, int nMode)
    {
        I
    }

When the cursor run the macro function in vivo, it will be over the body of the function

/******************************************************************************
 * nOpenConfigFile -
 * DESCRIPTION:-
 *
 * Input:   N/A
 * Output:  N/A
 * Returns: N/A
 *
 * modification history
 * --------------------
 * 1.00, Apr 19, 2007, T357 written.
 * --------------------
 ******************************************************************************/

In which the function name and write the date automatically according to the actual situation of filling, T357 utils.em string by modifying the file, change the name you need.

6   Appendix 3 - Recommended format

The so-called Rengeyouzhi here will not say.

Guess you like

Origin www.cnblogs.com/aaronLinux/p/11109719.html