Code Editor

The Code Editor is advanced text editor fashioned to satisfy needs of professionals. General code editing is the same as working with any standard text-editor, including familiar Copy, Paste and Undo actions, common for Windows environment.

Available Code Editor options are: Editor Settings, Editor Colors, Auto Correct, Auto Complete and Style.

Editor Settings

Main Editor Settings Features are :

Editor Settings Window

Auto Save

Auto Save is a function which saves an opened project automatically, helping to reduce the risk of data loss in case of a crash or freeze. Autosaving is done in time intervals defined by the user.

Highlighter

Highlighting is a convenient feature for spotting brackets which notate begin or end of a routine, by making them visually distinct.

Spelling

The Spell Checker underlines unknown objects in the code, so they can be easily noticed and corrected before compiling your project.

Select Tools › Options from the drop-down menu, or click the Show Options Icon Show Options Icon and then select the Spell Checker Tab.

Comment Style

Code Editor has a feature to change the comment style to either single-line or multi-line. Commenting or uncommenting the selected code is done by a simple click of a mouse, using the Comment Icon Comment Icon and Uncomment Icon Uncomment Icon from the Advanced Edit Toolbar.

Code Folding

Code folding is IDE feature which allows users to selectively hide and display sections of a source file. In this way it is easier to manage large regions of code within one window, while still viewing only those subsections of the code that are relevant during a particular editing session.

While typing, the code folding symbols (- and -) appear automatically. Use the folding symbols to hide/unhide the code subsections.

Code Folding

Code Folding

Another way of folding/unfolding code subsections is by using Alt+ and Alt+.

If you place a mouse cursor over the tooltip box, the collapsed text will be shown in a tooltip style box.

Code Folding

Code Assistant

If you type the first few letters of a word and then press Ctrl+Space, all valid identifiers matching the letters you have typed will be prompted in a floating panel (see the image below). Now you can keep typing to narrow the choice, or you can select one from the list using the keyboard arrows and Enter.

Code Assistant

Parameter Assistant

The Parameter Assistant will be automatically invoked when you open parenthesis “(” or press Shift+Ctrl+Space. If the name of a valid function precedes the parenthesis, then the expected parameters will be displayed in a floating panel. As you type the actual parameter, the next expected parameter will become bold.

Parameter Assistant

Bookmarks

Bookmarks make navigation through a large code easier. To set a bookmark, use Ctrl+Shift+number. The same princliple applies to the removal of the bookmarks. To jump to a bookmark, use Ctrl+number.

Go to Line

The Go to Line option makes navigation through a large code easier. Use the shortcut Ctrl+G to activate this option.

Column Select Mode

This mode changes the operation of the editor for selecting text. When column select mode is used, highlighted text is based on the character column position of the first character selected to the column of the last character of text selected.
Text selected in this mode does not automatically include all text between the start and end position, but includes all text in the columns between the first and last character selected.

Column mode editing is sometimes referred to as block mode editing as the act of selecting text forms a rectangle.

To enter this mode, press Alt + Left mouse button, drag the mouse towards the desired direction thus selecting the text.

Editor Colors

Editor Colors Window

Editor Colors option allows user to set, change and save text and color settings organized in schemes. Schemes represent custom graphical appearance that can be applied to GUI(Graphical User Interface) to satifsy tastes of different users.

Auto Correct

Auto Correct option facilitate user in such a fashion that it automatically corrects common typing or spelling errors as it types.

Auto Correct Window

This option is already set up to automatically correct some words. For example, if you type whiel, it will be corrected to while when you press the spacebar :

Auto Correct

User can easily add its common typos by entering original typo, for example btye, to the Original box, and replacement, byte, to the Replacement box, and just click "Add" button.
Next time when the typo occurs, it will be automatically corrected.

Auto Complete (Code Templates)

Auto Complete option saves lots of keystrokes for commonly used phrases by automatically completing user's typing.

Auto Complete Window

User can insert the Code Template by typing the name of the template (for instance, dow), then press Ctrl+J and the Code Editor will automatically generate a code :

Auto Complete Window

You can add your own templates to the list by entering the desired keyword, description and code of your template in appropriate boxes.
Autocomplete macros can retreive system and project information :

These macros can be used in template code, see template ptemplate provided with mikroC PRO for PIC installation.

Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code