for Windows and Linux
for macOS
Ctrl+Alt+S
Use this page to configure formatting options for Kotlin files. View the result in the Preview pane on the right.
On this page:
Tabs and Indents
Spaces
Use this tab to specify where you want spaces in your code. To have IntelliJ IDEA automatically insert a space at a location, select the check box next to this location in the list. The results are displayed in the Preview pane.
Wrapping and braces
In this tab, customize the code style options, which IntelliJ IDEA will apply on reformatting the source code. The left-hand pane contains the list of exceptions (Keep when reformatting), and placement and alignment options for the various code constructs (lists, statements, operations, annotations, etc.) The right-hand pane shows preview.
Alignment takes precedence over indentation options.
Keep when reformatting
Use the check boxes to configure exceptions that IntelliJ IDEA will make when reformatting the source code. For example, by default, the Line breaks check box is selected. If your code contains lines that are shorter than a standard convention, you can convert them by disabling the Line breaks check box before you reformat the source code.
Wrapping options
The wrapping style applies to the various code constructs, specified in the left-hand pane (for example, method call arguments, or assignment statements).
| Item | Description |
|---|---|
| Wrapping style | From this drop-down list, select the desired wrapping style:
|
Alignment options
Imports
| Item | Description |
|---|---|
| Top-level Symbols | Use this area to define how the top-level symbols are imported. The possible options are:
|
| Java Statics and Enum Members | Use this area to define how Java statics and enums are imported. |
| Other | Use this area to define how the other symbols are imported.
Insert imports for nested classes:
|
| Packages to Use Import with '*' | Use the table as follows:
|
Set from...
Click this link to reveal the list of languages to be used as the base for the current language code style. So doing, only the settings that are applicable to the current language are taken. All the other settings are not affected.
This link appears in the upper-right corner of the language-specific code style page, when applicable.
Click Reset to discard changes and return to the initial set of code style settings.