The File Type Options command allows you to define editing and display options based on the file name or extension of the file you are currently editing.
The file type of the current source file is automatically selected in the File Type Options dialog when it appears.
A file type is a file classification that is defined in the File Type Options dialog. Each file's name determines its file type by using the wildcards in the File Filter field. The file type specifies display options, editing options, and the language used to parse the file.
For example, the "C/C++ Source File" type applies to files that match the *.cpp wildcard pattern, and the file type specifies that the "C/C++ Language" is used to parse the file for symbolic information.
File Type
This pull-down list contains a list of all the file types you have defined so far. When you select a file type from this list, the other text boxes in the dialog box are updated to reflect the properties of that file type. The first entry in the list is always the Default file type, which you may modify, but not remove.
When the File Type Options dialog box first comes up, the file type of the current file is automatically selected here.
Add Type
Click this button to add a new file type. You will be prompted for the file type name.
Remove Type
Deletes the selected file type. This action is not undo-able.
Auto Indentā¦
Click this to change the Auto Indent settings for this file type. See: Auto Indenting.
File Filter
This text box should contain a delimited list of file name specifications. The entries in the list can be delimited with a space, a semi-colon, or a comma. Each entry can be either an unambiguous file name, or an ambiguous wildcard file specification. The entries should not contain a drive letter or a full path that includes backslashes.
For example,
*.c;*.h
Files are matched to File Types using wildcard filters.
Given a file name, Source Insight will identify the file's file type by searching all defined file types looking for a match on a file specification in the File Filter text box. In effect, Source Insight makes two passes through the entire set file type records to determine a file's file type.
1.First, it tries to find an exact match on the file name in all the File Filter lists.
2.If no exact match is found, it tries to find a wildcard match in all the File Filter lists.
3.If still no match is found, Source Insight assumes the file's type is the Default file type.
This means that you can treat some individual files in a special way. For example, "*.inc" is normally considered an Assembly File type, but let's say you have a file called "cmd.inc" that you want to have the C Source File type. In the C Source file type's File Filter text box, you would include "cmd.inc":
*.c;*.h;cmd.inc
If you include a simple * as the file filter for a file type, then it will become the default catchall type, instead of the "Default" file type. The catchall will only apply if the file does not already match any other file type.
You can add new entries to the file filter of a standard file type to make Source Insight include those files also. For example, by default, Source Insight considers C Source Files to be "*.c" and "*.h". If you also have C source files with .h2 extensions, then you can add "*.h2" to the File Filter list of the C Source File file type.
*.c;*.h;*.h2
You can control which file types are added to projects.
Whenever Source Insight displays a list of files, such as in the Add Files dialog box, the list is an expansion of the union of all File Filter text boxes in all defined file types. In other words, when you add new file types, those files will also appear in the file lists.
Include when adding to project
If enabled, then the Add File command and the automatic add file feature will include this type of file when looking for new files to add to the project.
Font Options Group
Emulate screen fonts when printing
If enabled, then Source Insight will attempt to select the same fonts for the printer as you have selected for the screen. If you are using a TrueType screen font, that should work fine. If not enabled, then the font setting of the Printer Fonts button is used when printing.
Line up white space
This option only applies if you have selected a proportionally spaced font. Fixed-pitch fonts, such as Courier New, are not affected.
You can use a proportional font and still display indentation correctly.
If enabled, Source Insight will attempt to use a fixed width for spaces and tabs so that tabs line up the same way they do with a fixed-pitch font. Programs generally look better with this turned on if you are using a proportional font. If you are tired of using Courier New (or some other boring fixed-pitch font) to view your code, try this!
If disabled, then Source Insight uses the natural widths of characters as reported by the font.
This option is helpful if you have to work with other tools, or people that use tools that display source code with fixed-pitch fonts. You will be able to use a proportional font, and still keep a valid representation of the fixed pitch font indentation.
You can control how Source Insight computes the fixed width of spaces by clicking the Spacing button in the Preferences: Display dialog box.
For more information, see Character Spacing Options.
Click this button to select a font to use for displaying the file on the screen. The name of the currently selected font is displayed to the right of the button. The screen font selected here becomes the default font for this file type. Style properties will also apply on top of this font. For example, a style for declarations might add "bold". Or a style might specify a different font and override the screen font selection in the file type.
When you click OK in the font selection dialog, you will see this prompt:
To apply the font to ALL the file types, type "yes" in the box and click OK. To only apply it to the current file type, click No.
Click this button to select a font to use for printing the file. The name of the currently selected font is displayed to the right of the button. This setting only has an effect if the Emulate screen fonts when printing option (described above) is turned off.
Parsing Group
Language list
This pull-down list contains a list of all the languages defined in Source Insight. Select from this list to specify how Source Insight should parse and display the current file type. For example, to parse the document as a Java source file, select "Java Language" from the list. You can also select "None" to use no parser.
To add a new custom language, select the item <New Language>.
The language selected here determines the syntax formatting, as well as how symbol declarations, such as functions and classes are parsed in the file.
Languageā¦
Click this button to open the Language Options dialog box. From there, you can add a new language, and edit the properties of a language. For example, you can edit the syntax formatting keyword list that is associated with each language. Each language type has its own keyword list. See: Language Options.
Custom Tag Type
This pull-down list specifies what type of symbol is found as a result of using the custom parser pattern in the Custom Pattern text box. The list contains all of the possible symbol types. One of the entries in the list says "No Custom Parser". If that item is selected, then Source Insight does not use the custom pattern. If any other item is selected in the list, then the custom pattern should contain a regular expression pattern for parsing symbol names out of the file.
Custom Pattern
This text box should contain a valid regular expression with one group in it. The group describes what part of the matching pattern is assumed the symbol tag. The symbol parsed by using this pattern is given the type indicated by the Custom Tag Type. If the Custom Tag Type is set to "No Custom Parser", then this text box is ignored.
Using a custom pattern that allows you to parse some symbols out of files for which Source Insight has no built-in knowledge. For example, the following string parses sections out of .INI files like WIN.INI.
^\[\(.*\)\]
You can define a new file type named "INI File" that uses this custom parsing pattern. Now, when you open a file like WIN.INI, you can jump to any of the section names or see them all in the symbol window.
Status Bar Options
This group controls the appearance of the status bar at the bottom of the program window.
Line, Col, Symbol
The status bar shows the line number, the column number, and the name of the symbol that the insertion point is in.
Line, Col, Char, Byte
The status bar shows the line number, the column position on the line, the character position on the line, and the byte position in the file.
Editing Options Group
This group of items controls how the file type is edited. All files of the selected file type will have the following editing options in effect.
Word Wrap
If checked then Source Insight will automatically wrap words onto the next line when the insertion point moves past the margin width. This only applies while you are typing new text. If not checked then Source Insight will not do any automatic wrapping of text.
Allow auto-complete
If enabled, then symbolic auto-completion is allowed for the file type if auto-completion is enabled globally in the Options > Preferences: Typing dialog box.
If enabled, then intelligent paste is allowed for the file type if intelligent paste is enabled globally in the Options > Preferences: Typing dialog box.
Tab Width
The width of a tab character in character spaces.
Margin Width
The width of text in characters spaces before automatic word wrapping will occur
If checked then Source Insight will expand a tab character to the equivalent number of spaces when you type a tab. The text will look the same as if a tab was typed, but spaces will be used to fill. If not checked then Source Insight will simply insert a tab character into the file when you type a tab.
Enter key inserts new line
If checked then pressing the Return or Enter key while typing will insert a new line. If not checked then pressing Return or Enter will move the insertion point to the beginning of the next line.
Show line numbers
Displays line numbers in the left margin.
Show right margin
Displays a light vertical line at the right margin. If you are using proportional fonts, then the right margin position is only approximate.
Allows code snippet expansion in this file type. If enabled, code snippets will appear in the auto-completion list when you type, and code snippet variables will be displayed in a highlighted color.
If checked then Source Insight will display a special symbol where ever a tab characters is, instead of just displaying white space.
If checked then Source Insight will display a special symbol where ever a space characters is, instead of just displaying white space.
Symbol Window
If enabled, then files with this file type will have a Symbol Window attached at the left side of their source windows. See: Symbol Windows .
The Symbol Window command on the right-click source file menu toggles this setting.
Use Overview
If enabled, then an Overview scroller will be displayed in the file's source window. at the far right edge. See: The Overview Scroller.
The Overview command on the right-click source file menu toggles this setting.
Show page breaks
Source Insight will show light horizontal lines that represent the printed page breaks. The pagination is computed based on syntax formatting, and the printer font that is selected.
Highlight references to selected symbol
References to the symbol at the caret position will be highlighted. For example, you can click in a variable name, and all references to the variable will be highlighted. The references are context sensitive, so a symbol in a different scope will not get highlighted.
Once enabled, if you click on a symbol name, all references to it in that file are highlighted. The highlight will only appear if more than one instance appears in the file.
To change the color or format of the highlight, select Options > Style Properties and edit the "Reference Highlight" style. By default, it only changes the text and background colors.
Use typing shortcuts for parentheses and quotes
This enables several typing shortcuts related to parentheses, square brackets, angle brackets, and quote characters. Typing an open parenthesis, bracket, or quote character will automatically insert the corresponding closing character. In HTML and XML files, opening and closing angle brackets (<>) are also inserted automatically.
For example, to insert (a + b), you would type this:
You Type |
Result - | marks the insertion point |
( |
(|) |
a + b |
(a + b|) |
) |
(a + b)| |
To insert the quoted string "Hello World", you would type this:
You Type |
Result - | marks the insertion point |
" |
"|" |
Hello World |
"Hello World|" |
" |
"Hello World"| |
If you just inserted an empty pair of parentheses, brackets, or quotes, and want to delete them, press Backspace. Both characters will be deleted. For example:
You Type |
Result - | marks the insertion point |
( |
(|) |
Backspace |
| |
If you type an open parenthesis just before another open parentheses, then the parenthesized block that follows will be surrounded with parentheses. For example:
You Type |
Result - | marks the insertion point |
Starting with |(thing) |
|(thing) |
( |
(|(thing)) |
The auto-indenting feature controls the level of indentation as you type new text. Source Insight supports Simple and Smart types of auto-indentation. Not all languages support the Smart level.
You can also reformat exiting source code using Tools > Reformat Source Code. See: Reformat Source Code Options.
Auto Indent Type
Specifies the type of auto-indenting. Automatic indenting occurs when you insert new lines.
None No special indenting occurs. Source Insight will return the insertion point to the very beginning of the next line when you insert a new line or word wrap.
Simple Source Insight will automatically indent text to line up with the previous or following line.
Smart Source Insight will automatically increase or decrease the indentation level when you insert new lines. Not all languages support smart indenting. If this button is selected, then the Smart Indent Options are applied.
These check boxes determine how the smart indenting affects open and closing curly braces.
Desired Indent Style |
Check box setting |
if (x) { } |
Clear both boxes. |
if (x) { } |
Select both boxes |
if (x) { } |
Select Indent Open Brace; |