7.1 Editor Usage

To begin using the Editor, create or open an existing file using File > New File

or File > Open File, respectively. Additional controls and features are described in the following sections.

Figure 7-1. Editor GUI

Desktop Controls

The following desktop items are associated with the Editor:

  • File menu – opens a file in an Editor window (see 13.1.1 File Menu).
  • Edit menu – accesses edit commands (see 13.1.2 Edit Menu).
  • Editor toolbar – also accesses edit commands – located at the top of each file’s Editor window (see 13.2.11 Editor Toolbar).
  • Window right-click (context) menu – for additional commands.

Display Controls

Basic display controls are shown in the table below. Additional formatting control may be found under 7.2 Editor Options.

Action Description
Maximize the Source Editor. Do one of the following:
  • Double click a file's tab in the Source Editor.
  • Make sure that the Source Editor window has focus and then press Shift+Escape.
  • Choose Window > Configure Window > Maximize.
Revert a maximized Source Editor to its previous size. Do one of the following:
  • Double click a file's tab in the Source Editor.
  • Press Shift+Escape.
  • Choose Window > Configure Window > Restore.
Display line numbers. Choose View > Show Line Numbers.
View two files simultaneously.
  1. Open two or more files.
  2. Click the tab of one of the files and drag it to the side of the window where you want the file to be placed. When a red preview box appears to show you where the window will be placed, release the mouse button to drop the window.

    The window can be split horizontally or vertically, depending on where you drag the tab.

Split the view of a single file.
  1. Right click the document's tab in the Source Editor and choose Clone Document.
  2. Click the tab of the cloned document and drag it to the part of the window where you want the copy to be placed.
Move between open files
  1. Press and hold the Ctrl key.
  2. Press the Tab key. A selection box will appear.
  3. Select the file you want to move to.
Format code automatically. Right click in the Source Editor and choose Format.

If any text is selected, only that text will be formatted. If no text is selected, then the whole file is formatted.

Basic Editor Features

The following table summarizes some of the more frequently-used features of the editor.

Editor Feature Reference
Unicode is supported. By default, newly-created projects in the IDE use ISO-8859-1 character encoding. To change this:

Right click the project name in the Projects window and choose Properties.

In the left column under Categories, select General.

On the bottom of the page, find Encoding and change.

Code is colored based on syntax. Tools > Options (MPLAB X IDE > Preferences for macOS), Fonts and Colors > Syntax.

Based on Encoding set during Project creation.

Errors are flagged as code is typed. See the Netbeans Help topic Using Hints.
Colored markers provide quick access to multiple symbols, errors, etc. Tools > Options (MPLAB X IDE > Preferences for macOS), Fonts and Colors > Annotations
Smart code completion makes suggestions and provides hints. Tools > Options (MPLAB X IDE > Preferences for macOS), Editor > Code Completion
Mouseover symbols in debug mode to see values. On halt when debugging, mouse over symbols to see values.

The default value format for mouseover evaluation relies on type information available from the debug information source (e.g. ELF). This format will be overridden when the symbol (by name) has had a format option applied to the value column in the Watches or Variables window. Value column format options applied to a symbol in the Watches window will persist from session to session until removed.

Note: You cannot view the value of macros in this way. Use the Macro Expansion Window by right clicking (or Cmd+Alt+Click for macOS) on the macro in the editor during debug.
Assembly and C code may be collapsed and expanded See 7.6 Code Folding.
Right clicking on a function (delay(x)) finds usages. This can limit find within a function (e.g., a local i variable). If selected, all usages of the method are displayed.
Right clicking on a function (delay(x)) shows a call graph
. The call graph has buttons on the side to switch order, etc. See 8.4 Call Graph.
Create comments with keywords (example: //TODO) in the source code and action items will be scanned and added automatically to the 14.2 Action Items Window. See the Netbeans Help topic:

netbeans.org/features/ide/index.html

regarding the Options Window, Team: Action Items.

File history is available to view recent changes and revert, even without a version control system. 8.8 Source Control: Local History
Navigation is simplified with items such as “Go to file,” “Go to type,” “Go to symbol,” “Go to header,” and “Go to declaration.” See “Navigate Menu.”
Refactor options (rename functions and variables, find all functions, etc.) for improving code structure. See 7.7 C Code Refactoring.

Editor Troubleshooting

For errors in code highlighted in the editor, see your compiler documentation. For information on error highlighting, see the NetBeans help topic:

netbeans.org/kb/docs/java/editor-codereference.html#coloring

Specific errors may be found under 12.5 Errors.