6.2 Overview: Text Editor |
The Magic C++ environment includes an integrated text editor to manage, edit, and print source files. Most of the procedures for using the editor should seem familiar if you have used other Windows-based text editors. With the Text editor, you can:
Set and customize syntax coloring for source files. Perform advanced find and replace operations in a single file or multiple files, including using regular expressions Navigate through sections of code by matching group delimiters, matching conditional statements, or using the Go To dialog box. Use Bookmarks to mark frequently accessed lines in your source file. Customize the Text editor with save preferences, the selection margin, tabs, and indents. Modify the font style, size, and color. Select lines, multiple lines. Use drag-and-drop editing within one editor window, between editor windows, and between the Text editor and the debugger. Manage the source window. Tip While using the Text editor, in many instances you can click the right mouse button to display a shortcut menu of frequently used commands. The commands available depend on what the mouse pointer is pointing to. |
6.2.1 About Automatic Statement Completion |
The Magic C++ Text editor uses IntelliSense to make writing your code easier and error-free. IntelliSense options include Statement Completion, which provides quick access to valid member functions or variables, including globals, via the Members list (as shown below). Selecting from the list inserts the member into your code.
You can also use IntelliSense to view code comments, function declarations, and variable type information. The Complete Word option (available from the Edit menu) finishes typing your functions and variables for you, or displays a list of candidates if what you've typed has more than one possible match.
Magic C++ IntelliSense options appear by default. You can turn them off. What do you want to know more about? Overview of IntelliSense options When the IntelliSense options are unavailable
What do you want to do? View the parameter list for a function Automatically complete a variable or function name
IntelliSense OptionsIntelliSense provides an array of options that put the C/C++ Language references literally at your fingertips. While coding, you no longer need to "switch away" to perform searches on language elements. You can keep your context, find the information you need, insert language elements directly into your code, and even have IntelliSense complete your typing for you. Note IntelliSense works automatically by default, but you can control this behavior from the Editor tab of the Options dialog box (Tools menu), in the Statement completion options area. If you choose to disable the automatic behavior, you can still invoke IntelliSense options from the Edit menu, or with a keystroke combination. Here is a summary of each IntelliSense option. List Members Option This feature displays a list of valid member variables or functions for the selected class or structure. Selecting from the list inserts the member into your code. For more information, see Viewing the Members List. For more information about the contents of the Members list, see Icons in the Members List. Quick Type Information Option This feature displays the complete declaration for any identifier in your code. Simply rest the mouse cursor over the identifier and its declaration appears in a pop-up window. For more information , see Viewing the Variable Type. Parameter Info Option This feature displays the complete declaration, including a parameter list, for the function to the left of the cursor. The parameter in bold indicates the next parameter required as you type the function. For more information, see Viewing the Parameter List for a Function. Complete Word Option This feature types the rest of a variable or function name once you have entered enough characters to disambiguate the term. If what you've typed has more than one possible match (or no match at all), invoking Complete Word displays the Members list, which you can then use to find the term and insert it into your code. For more information, see Automatically Completing a Variable or Function Name
When IntelliSense is UnavailableThere are certain cases when the IntelliSense options may not work as you expect. There is a code error above the cursor If there is an incomplete function or other coding error above the location of the insertion point, IntelliSense will be unable to parse the code elements and therefore will not work. You can comment out the applicable code to enable IntelliSense again. You are inside a code comment If the insertion point is within a comment in your source file, the List Members, Parameter Info, and Type Info options will not work automatically. However, you can still invoke them from the menu or keyboard. You are inside a string literal If the insertion point is inside the quotation marks around a string literal, as in:
IntelliSense options will not be available. The automatic options are turned off IntelliSense works automatically by default, but can be disabled. To see whether this is the case, check the Statement completion options on the Editor tab of the Options dialog box (Tools menu).
|
6.2.2 About Syntax Coloring |
Syntax coloring uses different colors for various code elements, such as keywords or comments. This coloring gives you visual cues about the structure and state of your code.
What do you want to do? |
6.2.3 About Text Search Methods |
With the advanced find and replace capabilities of the Text editor, you can search for text in a single source file or in multiple files. You can search for literal text strings or use regular expressions to find words or characters. A regular expression is a search string that uses special characters to match a text pattern in a file. You can use regular expressions with both the Find and Replace commands. With the Find and Replace commands, you can:
If you are looking for a string that occurs multiple times in your file, you can use the FindNext and FindPrev commands. What do you want to do? |
6.2.4 About File Navigation |
About Matching Group Delimiters Source code is often grouped using delimiters such as (), {}, and []. These groupings are called levels. You can navigate these levels using the Hot key CTRL+] commands. The Text editor understands nested levels, and matches the correct delimiter even if the level spans several pages and itself contains many levels. This searches for one of the matched delimiters, and then positions the cursor before the matching delimiter. About Go To The Go To dialog box allows you to jump quickly to a line in a file. About Bookmarks You can set bookmarks to mark frequently accessed lines in your source file. Once a bookmark is set, you can use menu or keyboard commands to move to it. You can remove a bookmark when you no longer need it. You can use both named and unnamed bookmarks. Bookmarks are saved between editing sessions. Once you create a bookmark,it has no name by default. You can jump to that location whether or not the file is open. bookmarks store both the line number and the file name of the location of the cursor when the bookmark was created. This location is adjusted whenever you edit the file. Even if you delete the characters around the bookmark, the bookmark remains in the correct location. You can browse the bookmarks while a workspace opened, also browse the bookmark in a single file. Note :Bookmark information is temporary if there are no workspace opened and it will be lost after you close a file.
|