Syntax Formatting

This command specifies syntax formatting options for displaying source files. It activates the Syntax Format­ting page of the Options > Preferences dialog box.

Source Insight uses information gathered from its language parsers to format source code. Identifiers can be displayed in different fonts or font sizes, along with a variety of effects such as bold and italics. See: Syntax Formatting and Styles.

Formatting is applied using "styles". A style is a set of formatting properties. For example, a style may specify bold + italic. You can edit each style's formatting properties with the Style Properties command.

inset_42_1.jpg

 

Styles…

Click to edit the style properties.

File Types…

Click to edit the file types.

Basic Options

Basic option are:

Use Syntax Formatting

Enable this to have Source Insight display source code with syntax formatting. If disabled, then source code will display with no coloring or font changes.

Use only color formatting

All non-color formatting properties, such as font size changes, or bold and italics, will be suppressed. Display tokens will only contain color changes. This is similar to how earlier versions of Source Insight displayed text.

Use no color formatting (monochrome)

If enabled, then Source Insight will suppress all color changes. Text will be displayed in black and white and gray.

Apply Styles for Language Elements

Source Insight will apply styles to display tokens based on their lexical and contextual meaning. Each option in this group enables successively more elaborate formatting.

Symbol declarations

Declarations of symbols are formatted with the appropriate "Declare…" styles. For example, a function name will appear in the "Declare Function" style where it is declared.

Function-local symbol declarations

Declarations of local function scope variables and other symbols will be formatted with the appropriate "Declare…" styles. This includes local variables, and function parameters.

References to function-local symbols

References to local function scope variables and symbols are formatted with the appropriate "Ref to…" refer­ence styles. For example, references to (i.e. usages of) a local variable will have the "Ref to Local" style.

References to non-function-local symbols

References to symbols declared outside of function scopes, such as class scopes and the global scope, are formatted with the appropriate "Ref to…" reference styles. This option requires more work, and it will slow down the display somewhat. The reference information is cached, so once a piece of code is rendered, it usu­ally will display quickly afterwards.

References to members

References to structure and class members are formatted with the "Ref to Member" style. The veracity of the member reference can be controlled with the Qualify references to members option.

Special comment styles

Source Insight supports special comment styles that are controlled by special //1-4 comment heading tokens, and the placement of comments. If this option is enabled, then Source Insight will apply the appro­priate comment style to those special comments

Comment Headings

Comment heading styles are comments that begin with a single digit in the range 1 to 4. For example:

//1 This is heading one.

//2 This is heading two.

When the comment styles are used, the //x at the beginning of the comment is hidden, and the heading style formatting is applied to the rest of the line. The result looks like this:

inset_106.jpg

 

Inactive conditional code blocks

Code contained in inactive conditional code blocks are formatted with the "Inactive Code" style. An inactive code block is one contained in an inactive #ifdef, #if, #elif, or #else branch. You control the state of the condi­tions with the Edit Condition command.

Symbol Reference Lookups

When a potential reference is encountered, Source Insight must verify that the symbol is declared some­where. This section controls how Source Insight resolves references to symbols declared in the project, as it renders source code.

Search in the Project Symbol Path

Source Insight will search not only the current project for a declaration, but also all the projects in the Project Symbol Path.

Qualify references to members

If enabled, Source Insight will verify that the member declaration exists before formatting it with the "Ref to Member" styles.

If disabled, then Source Insight will format tokens with the "Ref to Member" style if the tokens look syntacti­cally like a member reference. There is no guarantee that the member actually exists. For example:

PtrFoo->somemember // looks like a member reference

FooThing.somemember //  looks like a member reference

Qualify references to functions

If enabled, Source Insight will verify that the function declaration exists before formatting it with the "Ref to Function" or "Ref to Method" styles.

If disabled, then Source Insight will format tokens with the reference styles if the tokens look syntactically like a function call. There is no guarantee that the function actually exists. For example:

SomeFunction(x) // looks like a function reference