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.

Desktop Controls

The following desktop items are associated with the Editor:

Display Controls

Basic display controls are shown in the table below. Additional formatting control may be found under 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. 1.Open two or more files.
  2. 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. 1.Right click the document's tab in the Source Editor and choose “Clone Document.”
  2. 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. 1.Press and hold <Ctrl>.
  2. 2.Press <Tab>. A selection box will appear.
  3. 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 button, Syntax tab.

Based on Encoding set during Project creation.

Errors are flagged as code is typed. See the table of contents for the Netbeans Help topic:

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

Colored markers provide quick access to multiple symbols, errors, etc. Tools>Options (MPLAB X IDE>Preferences for macOS), Fonts and Colors button, Annotations tab
Smart code completion makes suggestions and provides hints. Tools>Options (MPLAB X IDE>Preferences for macOS), Editor button, Code Completion tab
Mouseover symbols in debug mode to see values. On halt when debugging, mouse over symbols to see values.
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 Code Folding.
Right clicking on a function (delay(x)) finds usages. This can limit find within a function (e.g., a local i variable). See the Netbeans Help topic:

http://wiki.netbeans.org/Find_Usages_in_Compiled_Dependencies

Right clicking on a function (delay(x)) shows a call graph
The call graph has buttons on the side to switch order, etc. See “View The Call Graph.”
Create comments with keywords (example: //TODO) in the source code and action items will be scanned and added automatically to the Action Items window. See the Netbeans Help topic:

https://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. Control Source Code using 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 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:

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

Specific errors may be found under Errors.