Create foreach loop automatically inserts newline

Answered

I might just be doing this wrong, but I let intelij generate a foreach loop for me, either by using Ctrl + j or by just typing "for" and the menu comes up. I select the foreach option and press Enter and I get a foreach loop with an extra newline in the middle, like

It does that when I use Tab instead of Enter as well.

What am I doing wrong here?

Thank you.

6 comments

Please check your code style settings:

0

Hi, thanks for answering. I've tried messing around with the style settings for a for() where you showed me but for some reason it keeps that behavior.

0

Does it happen with the default code style scheme? Try with all the defaults after removing IDE config/plugins folders (https://intellij-support.jetbrains.com/hc/articles/206544519), make a backup first so that you can restore these folders if it doesn't help.

0

I also have this same issue, its not related to code style, as theres no even a block to manage for each loops.. keeping default it still is messed up. thanks.

0

Report an issue with the steps to reproduce and a sample project (with your code style embedded) at https://youtrack.jetbrains.com/issues/IDEA.

Also attach the logs (https://intellij-support.jetbrains.com/hc/articles/207241085).

0

Please sign in to leave a comment.