IntelliJ formats my test code like this:
test("a configuration without classpath to analyze is not valid") {
Configuration(
None,
Seq(),
Seq(),
Map(),
Some(PrintConfiguration(print = Always("output")))
) should not be ('valid)
}
I hope we all agree that this is a rather stupid way to do this.
How can I configure IntelliJ in so that it moves Configuration
and everything belonging to it over to the left, two spaces indented relative to test
?
To clarify: most of the code gets indented properly, just code blocks in curly braces, that are parameters get aligne relative to the opening curly brace, not relative to the beginning of the function call.
Apply a predefined code stylePress Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. To configure a scheme for new projects, go to File | New Projects Setup | Settings/Preferences for New Projects | Editor | Code Style. Select the language for which you want to configure the code style.
In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.
Code style scheme settings are automatically applied every time IntelliJ IDEA generates, refactors, or reformats your code. The IDE comes with two pre-defined schemes: the Project scheme and the Default scheme. In the Project scheme, the settings that you configure apply only to your current project.
How about Settings -> CodeStyle -> Scala:
Also make sure to remove the "align when multiline settings" or set the "Do not align block expression parameters" on the Wrapping and Braces tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With