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 | 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 | This sign appears in the suggestion list before each specific intention action. If an intention action alert is disabled, the sign turns to . Disabled intention action is still available and can be enabled again. | |
Quickfix suggested | 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. | |
Disabled | 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:
Apply intentions
Click the light bulb icon (or press Alt+Enter) to open the list of suggestions.
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:
In the Settings/Preferences dialog Ctrl+Alt+S, select .
For each intention action, you can see a description and an example. To disable an intention, clear the checkbox next to it.
Disable intentions on-the-fly
Click the light bulb icon (or press Alt+Enter) to open the list of suggestions.
Select the action you want to disable, and click the right arrow.
Select
.