Code Style. Scala
On this page:
- Tabs and Indents
- Wrapping and braces
- Keep when reformatting
- Wrapping options
- Alignment options
- Braces placement options
- Blank lines
- Multi-line strings
- Type Annotations
Tabs and Indents
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.
The wrapping style applies to the various code constructs, specified in the left-hand pane (for example, method call arguments, or assignment statements).
Braces placement options
Use this tab to define where and how many blank lines you want IntelliJ IDEA to retain and insert in your code after reformatting. For each type of location, specify the number of blank lines to be inserted. The results are displayed in the Preview pane.
|Keep Maximum Blank Lines||In this area, specify the number of blank lines to be kept after reformatting in the specified locations.|
|Minimum Blank Lines||In the text boxes in this area, specify the number of blank lines to be present in the specified locations.|
Use this tab to configure import settings for your project.
|Class count to use import with '_':||Use this text field, specify the number of classes to be imported from a single package until all statements importing a single class are substituted with a statement importing an entire package.|
|Add import statement in closest block||Select this check box to add your import statement to the closest block instead of the top of your code.|
|Add fully qualified imports||Select this check box to add fully qualified imports.|
|Do not change path during optimize imports for local imports||Select this check box to eliminate changing the local imports into the fully qualified imports.|
|Sort imports lexicographically (for optimize imports)||Use this check box if you want IntelliJ IDEA to sort your imports in lexicographical order.|
|Collect imports with the same prefix into one import||Use this check box if you want IntelliJ IDEA to insert all imports with the same prefix into one.|
|Import members using '_'||If you select this check box then IntelliJ IDEA imports all members included in the object. If the check box is cleared, IntelliJ IDEA imports only a specific member such as method or a field from the object.|
|Use the shortest path, when trying to import reference with already imported name||Select this check box to let IntelliJ IDEA find the shortest available path when you import the reference with already imported name using code completion.|
|Classes to use only with prefix||This area lets you view the list of classes with prefixes. You can add a pattern to use appropriate classes only with prefix or you can remove a class from the list.|
|Import Layout||this area lets you view the layout of the import statements, add or remove blank lines between them,and add or remove package names. You can also move the rows in the layout up or down .|
Use these settings for the code inspections.
|Instance Type Annotations||Use this area to configure settings for Instance Type Annotations.|
|Local type Annotations||Use this area to configure settings for Local Type Annotations.|
|Special Cases||Use this area to configure setting for special cases in type annotations.|
This tab lets you define a set of rules that rearranges your code according to your preferences.
Use this tab to configure syntax when you use certain symbols in the code.
|Enforce procedure syntax for methods with Unit return type||Select this check box to show the explicit syntax for methods with Unit return type.|
|Replace '=>' with unicode symbol||Select this check box to change '=>' symbol to one in Unicode.|
|Replace '->' with unicode symbol||Select this check box to change '->' symbol to one in Unicode.|
|Replace '<-' in "for" generator with unicode symbol||Select this check box to change '<-' symbol to one in Unicode.|
|Kind Projector: Replace 'Lambda' with unicode symbol||Select this check box to change 'Lambda' symbol to one in Unicode.|