Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Continuation indent size is overridden by regular indent size #57

Open
rkrisztian opened this issue Aug 24, 2016 · 4 comments
Open

Continuation indent size is overridden by regular indent size #57

rkrisztian opened this issue Aug 24, 2016 · 4 comments

Comments

@rkrisztian
Copy link

rkrisztian commented Aug 24, 2016

Hi,

IDEA supports the concept of continuation indent. Its size is usually configured to twice as much as the regular indent size. Continuation indent can occur if e.g. you wrap the first line of an "if" or "for" or "try" statement in Java (and others like variable assignments, etc.). Continuation indent can also increase readability. Consider a line wrapped just before a block start in the case you use K&R style braces, and you don't wrap the lines around the parentheses. Then without a different indentation, it is hard to see whether the next line belongs to the block, or still to first line of the statement. And the EditorConfig plugin forces us to use the same indentation setting for continuation indentation as for regular indentation.

Example Java code without the EditorConfig support:

        try (FileInputStream x = new FileInputStream(new File("x"));
                FileInputStream x2 = new FileInputStream(new File("x2"));
                FileInputStream x3 = new FileInputStream(new File("x3"))) {
            System.out.println("x");
        }

Example Java code with the EditorConfig support enabled:

        try (FileInputStream x = new FileInputStream(new File("x"));
            FileInputStream x2 = new FileInputStream(new File("x2"));
            FileInputStream x3 = new FileInputStream(new File("x3"))) {
            System.out.println("x");
        }

I believe this is a bug of the plugin, and a decent fix may need a co-operation between the EditorConfig developers to add support for continuation indent (it is somewhat language specific though).

@KurtYoung
Copy link

+1 same here, took me 1 hour to figure out.

@WoodenDoors
Copy link

WoodenDoors commented Jan 17, 2017

+1
And here I thought I was going mad, when I found nothing that explained this in the IDEA Bug Tracker.
I'll probably just remove indent_size everywhere for now, since this breaks a lot of java code style.

@seanf
Copy link

seanf commented Jan 27, 2017

I found that the IDEA-specific setting continuation_indent_size = 8 helped.

See also https://youtrack.jetbrains.com/issue/IDEA-145069

@retrodaredevil
Copy link

I think that this issue is mostly fixed, however when using indent_style = tab, there is no way to set continuation_indent_size without defining how wide a tab character is. One of the benefits of using the tab character is that anyone can choose what they want the width of the tab character to be.

It would be nice if we could have something like this: continuation_indent_size = tab_width * 2, or something along that line.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants