How to change brace position in IntelliJ IDE?

25,922

Solution 1

From the IntelliJ documentation:

Go to the menu File | Settings | Project Settings | Code Style - Java. Select the 'Wrapping and braces' tab. Set 'Braces placement options' to 'Next line'.

Solution 2

Here is the exact working path. I have added screenshot with explanations.

Screenshot "How to change braces position in Intelli

Share:
25,922

Related videos on Youtube

user3595338
Author by

user3595338

Updated on September 18, 2022

Comments

  • user3595338
    user3595338 over 1 year

    I am using the IntelliJ IDEA ide for java coding. By default it produces curly braces on the same line as the function name, like so:

    function bla() {
    ..
    }
    

    Can i change it somewhere there so that i will do this instead?:

    function bla() 
    {
    ..
    }
    

    Thanks!

  • Steve HHH
    Steve HHH almost 8 years
    I had to go to File > Settings then search for Code Style in IDEA 2016.1.
  • Admin
    Admin over 7 years
    Preferences > Editor > Code Style > Java is another route, at least in 2016.2.
  • Yar
    Yar over 7 years
    didn't worked for me (yes, I copied the new style into the Project's)
  • Toskan
    Toskan over 7 years
    what i want is curly brace at end of function name and then a newline, e.g. function foo(){ \n\n
  • Mike Chase
    Mike Chase about 4 years
    Is it possible to update existing code with new rules? This worked for me when writing new code, but not any old code. Link
  • Dr. Freddy Dimethyltryptamine
    Dr. Freddy Dimethyltryptamine almost 3 years
    Do you know how can I add these settings for languages that don't have them by default? I need to change 'wrapping and braces' for ERB file, but the only options are tab and indent size. Maybe for these languages they are inherited from somewhere? Probably yes, yes they are, inherited from Ruby of course. If someone has this problem check the "parent" language settings