How does the continuation setting in Java code formatter work?
Hi everyone,
I have code like the following, which is automatically indented by one tab with size of 4 spaces. 1 tab for the method within the class, one tab for “return” within the method and a third tab for the continuation?

I'm asking because the continuation is configured to be 8 and I've read misleading info about what that continuation setting is. The help says it's about spaces, while I've read in your bugtracker somewhere else for a setting of 2 with as well tabs being used about two “columns”, which would be 8 spaces as well.
So I'm wondering which one is true, is the continuation some sort of columns, taking the indent size into account already or really the same like the indent size, a number of spaces?
I'm asking, because I'm somewhat sure that in the past in the same situation IntelliJ added one additional tab, so that things looked like the following. But it doesn't behave that way anymore and I'm wondering if I broke the formatter settings or whatever. I've already deleted my project setitngs files and started with defaults, but wasn't able to get the additional tab in the continuation.

Thanks for your help!
Please sign in to leave a comment.
Would it be possible for you to kindly provide a minimal sample project for me to reproduce the issue while ensuring that your sensitive code is not included? Thank you! Please upload it to https://uploads.jetbrains.com/ and paste the upload id here.
Upload id: 2024_03_27_RoxHHd7pBLwK6GoawMEsdq (files: continuation.zip, continuation2.zip)
The first project was newly created and works like my second screenshot, the second project was copied and cleaned-up and doesn't work like my first screenshot. Though I've chnaged code-style settings for the first project to be per-project as well and copied the settings from the second project into that.
But I think I've found the explanation: The second project uses .editorconfig and defines indentation of 4 there. IDEA says that some of those settings override other settings in IDEA and most likely the continuation is exactly one of those things overridden. It doesn't mention which settings are overridden, but continuation is only a special case of indentation.
So would be great if you could check that assumption and if so think about if it makes sense to override the continuation as well or handle that even with .editorconfig. Because in my case, I would prefer the continuation of 8 for company reasons and even when I reformat code the wrong continuation is applied.
Maybe add a switch, if to use continuation like indentation from .editorconfig or override it with whatever is configutred in IDEA?
Thanks for your time!
I'm sorry for not getting back to you sooner.
Yes, currently there is no detailed info about which configurations are overridden by editorconfig. Please file a feature request at https://youtrack.jetbrains.com/newIssue?project=IDEA and paste the link here, I'll help edit it and you may check the issue to cover all your keynotes and assign it to our developers.
Continuations should override .editorconfig : IDEA-351759 (jetbrains.com)