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 four 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.

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, 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 DynamicBox[ToBoxes[If[$OperatingSystem === MacOSX, Mathematica, Edit], StandardForm], ImageSizeCache -> {28., {0., 10.}}] ► Preferences ► Interface Tab.

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.

6.gif

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

7.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.

8.gif

Use the Tab key to advance to the next placeholder.

9.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.

10.gif

To insert an option template, select it with the arrow keys and then press Enter. You may also click on 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.

11.gif

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

12.gif

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

15.gif

New to Mathematica? Find your learning path »
Have a question? Ask support »