CLion 2019.2 Help

Intention actions

As you work in the editor, CLion analyzes your code, searches for ways to optimize it, and detects potential and actual problems. Intention actions cover a wide range of situations from errors and warnings to optimization suggestions.

Intention action types

Item

Icon

Description

Intention actions suggested

icons actions intentionBulb

A yellow bulb indicates that CLion just proposes to alter your code. It covers a range of situations from warning correction to suggestions for code improvement (like micro-refactorings).

Specific intention action

icon intentionActionEnabled

This sign appears in the suggestion list before each specific intention action. If an intention action alert is disabled, the sign turns to icon intentionActionDisabled. Disabled intention action is still available and can be enabled again.

Quickfix suggested

icons actions quickfixBulb

A red bulb with an exclamation mark indicates that CLion suggests a way to fix an error. It is related to Create from usage intentions and Quick fixes.

cl redbulb

Disabled

intentionBulbGrey

Alert is disabled, but the intention action is still available and can be enabled again.

Support in languages

In CLion, you can apply intention actions to code in all the supported languages except for JSON and YAML (see CLion Features in Different Languages, table Code analysis and assistance). Below you can find code snippets in four languages showing examples of different types of the Intentions:

Example: intention action on C++
Example: intention action on Objective-C
Example: intention action on Python
Example: intention action on JavaScript

Apply intentions

  1. Click the light bulb icon (or press Alt+Enter) to open the list of suggestions.

  2. Select an action from the list.

Configure intentions

You can view the full list of available intention actions, and disable actions that you don't need at the moment:

  1. In the Settings/Preferences dialog Ctrl+Alt+S, select Editor | Intentions.

  2. For each intention action, you can see a description and an example. To disable an intention, clear the checkbox next to it.

    Intentions settings

Disable intentions on-the-fly

  1. Click the light bulb icon (or press Alt+Enter) to open the list of suggestions.

  2. Select the action you want to disable, and click the right arrow.

  3. Select Disable <intention action name>.

    cl intentions disable

Last modified: 27 November 2019