Context window
Context window
The Context window is a Source Insight innovation that automatically provides relevant information while you are viewing and editing your source code. It is a floating, dock-able panel window that displays contextual information while you type or click on things. For example, if you click on a function call, the Context window will display the function’s definition. If you click on a variable, the Context window will decode its declaration to show you its base structure or class type.
The Context window works in conjunction with other panel windows to enhance those windows functionality. For example, the Context window automatically displays files selected in the Project File List, symbols in the Project Symbol List, and other types of previews.
The Context window shows information about the selected identifier in the source file window. In this case, it is showing the definition of the selected class member function.
Figure 3.11 The Context window on the bottom shows the declaration of the selected symbol.
You can toggle the Context window on and off by selecting View > Panels > Context window.
The following sections describe typical use cases for the Context window.
88 Source Insight 4 User Guide
Context window
Previewing Files and Source Code
The Context window is used to quickly preview files and other things without having to open them. For example, if the Project File List panel is in front, the Context window previews the currently selected file.
Figure 3.12 The Context window is previewing the file selected in the Project File List panel.
The Context window previews the following types of objects:
•
Files selected in the Project File List, Project Folder Browser, and Directory Compare panels
•
Symbol definitions in the Project Symbol List panel
•
Reference locations in the Relation Window panel.
•
Code Snippets in the Snippet panel
•
Clips in the Clips panel
•
Bookmark locations in the Bookmarks panel
•
Symbol selected in the symbol pane in a source file window
•
Symbol selected in the auto-completion list.
•
Source Window selected in the Window List panel
Context window Results
To summarize, the Context window does the follow:
Your Action
Selecting (clicking) on an identifier in a source file window
Selecting a symbol in the Project
Symbol List
Context window Result
Shows symbol definition based on context.
If more than one symbol matches, the Context window will show a list of matches.
If the symbol is an instance of a class or data structure, then the class or data structure declaration is shown.
Shows the symbol’s definition.
Source Insight 4 User Guide 89
Context window
Your Action
Selecting an item in the Relation
Window
Typing in a source file window
Context window Result
If the item is a reference to a symbol, then it shows the place where the reference or call occurs. Otherwise it shows the definition of the selected symbol.
If the auto-completion feature is enabled, then it shows the declaration of the selected item in the autocompletion list
Shows the location of the bookmark.
Selecting a bookmark in the
Bookmark Window
Selecting a clip in the Clip Window
Selecting an item in the Snippet
Window
Selecting an item in the Window
List (list of open file windows)
Typing or selecting an item in the symbol window pane of a source file window
Shows the clip contents
Shows the body of the selected snippet.
Shows the contents of the file window.
Shows the symbols definition.
Showing Declarations and Definitions
When you click on an identifier name in a source file window, the Context window will show you the symbol’s declaration automatically. Functions and other symbols show up in the Context window along with their parameters and other definition information.
The Context window determines what type of symbol you are clicking or typing. For example, if you click on a variable, it will show you the declaration of the variable. If the variable is a data structure instance or a pointer to a data structure, then the Context window will show you the structure or class definition.
Decoding Base Types to Show Structures
The Context window will determine the “base” structural type of a symbol by climbing up the type hierarchy.
That is, typedefs are decoded all the way back to the base structure type. For example, if you have code like this: struct S { ... }; typedef S T; typedef T *PT;
PT ptvar;
...
...
ptvar->mem....
If you select the mem
in ptvar->mem
, then the Context window will find the declaration of
PT ptvar
, and decode the type hierarchy until it finds the struct S
, and it will display the declaration of the field mem
within struct S
.
The Context window also decodes class hierarchies dynamically. That is, it will travel up the class derivation hierarchy looking for members that are in scope.
Customizing the Context window
The Context window Options command allows you to change the Context window settings. You can turn off
the base type decoding mentioned above, and control how the context window tracks the cursor. See “Context Window Options” on page 173.
90 Source Insight 4 User Guide