Can I set IntelliJ to automatically indent the code body?

Question 1: Can IntelliJ be installed to automatically indent the body of the code when creating a new line?

Here is an example of what I mean:

I have this method:

    public static void main(String[] args)
        {
            System.out.println("Hi there.");
        }

After pressing the return key after entering the expression, I get the following:

    public static void main(String[] args)
        {
            System.out.println("Hi there.");
        // the new line aligns itself with the braces.
        }

I would like this to do the following:

    public static void main(String[] args)
        {
            System.out.println("Hi there.");
            // the new line aligns itself with the preceding line
        }

I was unable to find a setting anywhere in the Settings section that would make this the default behavior. Does it exist, and will I skip it, or am I looking for a unicorn?

Question 2: Is it possible to cancel the body of the body by default? If so, where can it be found?

Example:

After using the "Reformat Code ..." command, I get the following:

    public static void main(String[] args)
        {
        System.out.println("Hi there.");
        // the code body is realigned with the braces
        }

Is it possible to install IntelliJ for this, and if so, where can I find this option ?:

    public static void main(String[] args)
        {
            System.out.println("Hi there.");
            // the code body is indented from the braces
        }

, .

. .

+5
2

Next line, each shifted:

enter image description here

+4

IntelliJ IDEA 15

> ... > p > a > Java > > > a > ,

0

All Articles