Using the Input Assistant

Input Assistant Overview
The Input Assistant helps you automatically complete code, discover functions and options, and reduce oversights and typographical errors while coding.
The Input Assistant feature set has the following components:
Context-sensitive autocompletion Type only a few characters and complete your code fragment by selecting a match from a list of suggestions.
Function templates Insert fully editable descriptions of common functions into your notebook.
Option templates View and insert options related to your current function.
Dynamic highlighting Highlight code as you type to more easily identify which part of the code you are working in.
String completion Autocomplete string arguments inside functions.
File name completion Autocomplete file names and paths from the files and directories on your machine.
Color chooser Choose a specific RGB color from an autocomplete interface.
Function template tooltip Bring up function templates by clicking a tooltip. This also works to give descriptions of errors in your code.
The Input Assistant may be enabled or disabled via the Interface tab of the Preferences menu.
Input Assistant Features

Context-Sensitive Autocompletion

As you type, a list of possible functions and variables (both system- and user-defined) is displayed after a user-defined delay. The list is refined automatically as you type additional characters.

1.gif

Completion suggestions are intelligently and automatically prioritized, based in part on your usage patterns and the context in which you are coding.

2.gif

Completions can be inserted using the keyboard or the mouse. Select a completion with the mouse pointer or arrow keys. Press Enter or Tab, or click to insert the completion.
The topmost suggestion is selected by default.
Access documentation for a function or variable by clicking the document icon next to the function name. The documentation will open in a new window.

3.gif

Autocompletion also offers variables you have assigned.

4.gif

The delay before code completion suggestions are displayed can be adjusted via Mathematica Preferences Interface.

Function Templates

Function templates describe common formatting for specified functions.
Function templates can be accessed via code completion. If an inserted function has associated templates, a new button will display after inserting the completion.

5.gif

Press Tab or Enter, or click the displayed down arrow icon to access a list of templates for the current function.

6.gif

Alternatively, pressing Ctrl+Shift+ K after fully typing a function name will access the template list.
Inserted function templates are fully editable text. Variables that require completion are represented by a yellow placeholder. The currently selected placeholder is highlighted in blue. Typing any character will replace the placeholder with that character.

7.gif

Use the Tab key to advance to the next placeholder.

8.gif

Note that while placeholders may describe a valid value, they are not part of the code. You must replace each placeholder to successfully evaluate your input.

Option Templates

Similar to function templates, option templates are insertable and editable descriptions of options for a given function. A list of available option templates is invoked by typing , after the arguments. You may also be prompted to add options upon completion of a template.

9.gif

To insert an option template, select it with the arrow keys and then press Enter. You may also click a suggestion to insert the option template.

Dynamic Highlighting

Dynamic highlighting adds emphasis to the current function name as well as any matching brackets, braces, and parentheses. Your cursor position determines what is highlighted.

10.gif

The current function name, opening bracket, and matching end bracket are highlighted while inside of that function.

11.gif

Matching parentheses () and braces {} are highlighted whenever your cursor is placed by the opening or closing character.

12.gif

String Completion

When assigning string arguments inside a function, you will be provided with a list of applicable arguments. This includes completing arguments for computable data, character encodings, and text styles.

13.gif

14.gif

File Name Completion

The Input Assistant can complete file paths, helping you to build them up from the current directory. As you type, folders and files inside the parent folder are listed and filtered. Complete the name of a folder or file on the list by selecting and clicking it or by continuing to type until it is highlighted and pressing Enter (Return on Mac).

15.gif

Color Chooser

Selecting "choose color" in the autocompletion menu for the function RGBColor brings up a contextual interface that helps you to visually select a specific color in RGB format. Color models such as HSB, CMYK, LAB, LUV, and XYZ are also supported.

16.gif

Function Template Tooltip

Hovering over a function head provides the function template information.
A description for the error is also provided when not enough arguments are given or when there are too many arguments.