Skip to content Skip to sidebar Skip to footer

Android Studio/intellij - Curly Braces Doesn't Go To New Line Even With Proper Settings

In Editor > Code Style > Java, I currently have my Braces placement settings to 'Next Line' for In class declaration, In method declaration, and Other. Yet when I create a ne

Solution 1:

From Editor > Code Style > Java > Wrapping and Braces go to:

  • Braces placement
    • In method declaration: Next line

Here's an example screenshot:

enter image description here

IntelliJ will leave the opening brace on the same line when you hit ENTER but if you reformat that class then IntelliJ will apply your chosen format resulting in the opening brace being moved onto the next line. You can reformat your code from the menu: Code > Reformat Code or have a look at Preferences > Keymap > Main Menu > Code > Reformat Code to see the keystroke combination for applying the formatter.

Solution 2:

apparently some one at Google decided to act like Microsoft and try to force their opinion on the rest of us and disabled the ability to reformat the coed (almost) at all,

check their FAQ regarding Dart formatter at: https://github.com/dart-lang/dart_style/wiki/FAQ

Can't format Dart

i suggest using a different IDE (funny enough like MS Visual Studio Code)

I always thought that the IDE's responsibility is to allow each person style his/hers code the way their brain can process it easily and fast recognize the code parts (hence styling and coloring code),

a nice feature would be the ability to see the code in the IDE the way we like it, but when saved to git - reformated to a general / company standarts, and when the code is loaded from the git it should be auto reformat to the way my IDE is set to display it

uniqueness and diversity should be celebrated and not forced into darker days rules where we are all the same

Post a Comment for "Android Studio/intellij - Curly Braces Doesn't Go To New Line Even With Proper Settings"