Skip to end of metadata
Go to start of metadata
While inspections provide quick-fixes for code that has potential problems, intentions help you apply automatic changes to code that is correct.

To get a list of intentions applicable to the code at the caret, just press Alt + Enter.

1. Optimize statements and manage braces

Since the IDE is aware of the data flow in your code, it can help you optimize Boolean conditions and transform if/else statements:

With intentions you can, for example, automatically add and remove braces for your statements:

2. String concatenation

If you have String concatenation, the IDE can help you replace it with a String.format expression or a StringBuilder pattern.

3. Switch between loop declaration styles

With intentions you can also switch between loop declaration styles or even reverse its direction.

4. Math expressions

If you have a complicated math expression, the IDE will offer you to simplify an expression or possibly clarify it with parentheses.

5. Disable intention

If you don’t want to see a certain intention, you can disable it by selecting the right arrow on the intention.

6. Settings

The complete list of intentions (several hundred in total), grouped by language and framework, can be found in SettingsIntentions. Here you can enable/disable whole groups of intentions:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.