Code Completion. freescale IDE 5.7
โฆษณา
โฆษณา
Editing Source Code
Code Completion
Code Completion
Use code completion to have the IDE automatically suggest ways to complete the symbols you enter in a source file. By using code completion, you avoid referring to other files to remember available symbols.
C/C++ Code Completion will function more effectively when “Language Parser” is selected for the “Generate Browser Data From” option in the Build Extras target settings panel for a project. Java Code Completion is not affected by this setting.
Code Completion Configuration
You can activate, deactivate, and customize code-completion operation. These tasks are associated with code completion:
• Activate automatic code completion
• Trigger code completion from the IDE menu bar
• Trigger code completion from the keyboard
• Deactivate automatic code completion
Activating Automatic Code Completion
Activate automatic code completion to have the IDE display a Code Completion window that helps you complete the symbols you enter in source code. The Code Completion preference panel configures the Code Completion window behavior.
1. Choose Edit > Preferences.
The IDE Preferences window appears.
2. Select the Code Completion preference panel in the IDE Preference Panels list.
Selecting this option configures the IDE to automatically open the Code Completion window.
field.
This delay determines how long the IDE waits between the time you type a trigger character and the time the Code Completion window appears. If you perform any action during this delay time, the IDE cancels the Code Completion operation.
5. Save your preferences.
Click the Save or Apply button.
96 IDE 5.7 User’s Guide
Editing Source Code
Code Completion
The Code Completion window now appears automatically to help you complete code in editor windows.
Triggering Code Completion from the IDE Menu
Trigger code completion from the main menu to open the Code Completion window.
1. Bring forward an editor window.
2. Begin typing or place insertion point at end of source code that you want to complete.
3. Choose Edit > Complete Code
The Code Completion window appears. Use it to complete the symbol at the insertion point.
Triggering Code Completion from the Keyboard
To open code completion from the keyboard:
1. Bring forward an editor window.
2. Begin typing or place insertion point at end of source code to complete.
3. Press the appropriate code completion shortcut key combination.
lists the default code completion key bindings for each IDE host. Use the
Customize IDE Commands panel to change these key bindings.
Table 10.2 Code Completion Key Bindings
Host
Windows
Macintosh
Linux/Solaris
Get Next
Completion
Alt-/
Control-/
Control-/
Get Previous
Completion
Alt-Shift-/
Control-Shift-/
Control-Shift-/
Complete Code
Alt-.
Control-.
Control-.
Deactivating Automatic Code Completion
Deactivate automatic code completion to prevent the IDE from displaying the Code
Completion window as you edit source code. The Code Completion preference panel configures Code Completion window behavior.
IDE 5.7 User’s Guide 97
Editing Source Code
Code Completion
You can still manually trigger code-completion functionality from the keyboard or from the main menu.
NOTE
To dismiss the Code Completion window after it automatically opens, press the
Esc key or click outside the active editor window.
1. Choose Edit > Preferences.
2. Select the Code Completion preference panel in the IDE Preference Panels list.
Clearing this option prevents the IDE from automatically opening the Code
Completion window.
4. Save your preferences.
Click the Save or Apply button.
Code Completion Window
The Code Completion window displays possible symbols based on the context of the insertion point. For example, in Java you can complete code for any Java class, method, and variable from any package that has been imported or is being used elsewhere in the project.
shows the Code Completion window. Table 10.3
Code Completion window.
explains the icons that appear in the Code
Completion list.
98 IDE 5.7 User’s Guide
Figure 10.2 Code Completion Window
Editing Source Code
Code Completion
Table 10.3 Code Completion Window Items
Icon Item
Code
Completion list
Disclosure
Triangle
Resize Bar
Documentation pane
Explanation
Lists available variables and methods or functions along with their corresponding return types or parameters. This list changes based on the context of the insertion point in the active editor window. Icons help distinguish items in the list.
Click to toggle display of Documentation pane for programming languages that support it.
Drag to resize the Code Completion list and the
Documentation pane.
Displays summary information or documentation for the selected item in the Code Completion list.
This pane appears only for programming languages that support summary information or documentation.
IDE 5.7 User’s Guide 99
Editing Source Code
Code Completion
Table 10.4 Code Completion Window Icons
Icon Code Type
Class
Icon
Function
Global Variable
Language Keyword
Local Variable
Constant
Code Type
Method
Namespace
None
Package
Variable
100
Navigating the Code Completion Window
Navigate the Code Completion window by mouse or keyboard. You can perform these tasks:
• Resize the window
• Navigate the window by keyboard
• Refine the Code Completion list by keyboard
1. Bring forward an editor window.
2. Place the insertion point at the end of the source code to complete.
3. Choose Edit > Complete Code or use keyboard shortcut.
The Code Completion window appears.
4. Use the mouse to resize the Code Completion window (Mac and Windows).
The new window size remains in effect until you refine the Code Completion list or close the Code Completion window. You refine the Code Completion list by typing additional characters in the active editor window.
5. Use the keyboard to navigate the Code Completion list.
explains how to navigate the Code Completion list by keyboard.
IDE 5.7 User’s Guide
Editing Source Code
Code Completion
Table 10.5 Navigating Code Completion List by Keyboard
Key
Up Arrow
Down Arrow
Page Up
Page Down
Action
Select the previous item
Select the next item
Scroll to the previous page
Scroll to the next page
6. Use the keyboard to refine the Code Completion list.
The Code Completion list updates as you add or delete characters in the active editor window. Continue adding characters to narrow the list, or delete existing characters to broaden the list. Press the Backspace key to delete characters.
Selecting an Item in the Code Completion Window
Select an item in the Code Completion window to have the IDE enter that item in the active editor window at the insertion point.
1. Bring forward an editor window.
2. Place the insertion point at the end of the source code to complete.
3. Choose Edit > Complete Code.
4. Select an item in the Code Completion list.
5. Enter the item into the active editor window.
Press the Return or Enter keys on the keyboard or double-click the item to have the
IDE insert that item into the editor window.
Completing Code for Data Members and Data Types
Complete code for data members for programming languages that support it. For a list of data members type the period (.) character and activate the code completion window.
shows an example of helping you select the correct data type depending on
what code has been typed in the source file.
IDE 5.7 User’s Guide 101
Editing Source Code
Code Completion
Figure 10.3 Code Completion List of Data Types
102
Completing Code for Parameter Lists
Complete code for parameter lists for programming languages that support it. For example, you can complete code for parameter lists by typing the open parenthesis ( character.
1. Bring forward an editor window.
2. Place the insertion point at the end of the function or method to complete.
3. Type an open parenthesis to trigger a parameter-list.
4. The Code Completion window appears.
The upper portion of this window lists different (overloaded) versions of the function or method. The lower portion shows possible parameter lists for the selected function or method in the top portion. Use this window to complete the parameter list for the function or method.
IDE 5.7 User’s Guide
Figure 10.4 Code Completion for Parameter Lists
Editing Source Code
Code Completion
Completing Code for Pragmas
In the Mac or Windows hosted IDE you can display a list of pragmas in the code completion window.
1. Bring forward an editor window.
2. In your source file, type #pragma followed by a space.
3. Activate the code completion window (cntrl . or Alt .).
The code completion window will display list of pragmas.
Figure 10.5 Code Completion for Pragmas
IDE 5.7 User’s Guide 103
Editing Source Code
Code Completion
104 IDE 5.7 User’s Guide
ดาวน์โหลด
โฆษณา