Content assist

Content assist, also known as code completion, makes it easier to enter code by providing a list of available classes, operations, attributes, and so forth, when editing code. Apart from speeding up editing, content assist also prevents typing errors and means that you do not have to remember all the names of elements in the model and in code.

There are two modes of content assist:

Content assist is supported in the Code view and the Code editor. You invoke it by pressing CTRL+SPACE. Sometimes, while typing, content assist might also appear automatically (for example, when a '.' or '::' has been typed). The picture below shows an example of the content assist popup:

Whether you get the basic or full content assist depends on the mode of the Code view or Code editor. If the header says ”Showing code from the model,” only basic content assist is available. If code has been generated, you can load generated source (CTRL+SHIFT+L) to switch the mode to ”Showing code from the file”. In this mode, full content assist is available.

Content assist is also available in some of the fields in the Properties view and in some dialogs. Such fields are marked by a small lightbulb icon. For example, the Type field of an attribute supports content assist.

When content assist is used outside of the Code view or Code editor, you always get the basic content assist only.

In addition to providing a list of names for code completion, content assist also provides template proposals. These are commonly used code fragments that are defined in the preferences (C/C++ - Editor – Templates). The use of template proposals saves you from typing, and makes it easier to remember certain common code fragments (boilerplate code). Template proposals appear when pressing CTRL+SPACE a second time in the content assist popup. Template proposals do not require a generated file and are available for both basic and full content assist.