code formatting problem

since the newest nightly for idea x, the plugin always puts { on a new line. how can i switch that of? i didn't find an option in the code style panels

8 comments

The formatting settings are being merged with the regular Java settings. So check Settings -> Code Style -> Wrapping and Braces -> Braces Placement -> end-of-line.

0

nooooooooooooooooooooooooooooooo i want the scala settings to be different form java. in java, i like *new line{, in scala i don't want it :(
this means i cannot mix java & scala in the same module

0

This settings are same for all languages. It's strange that for Scala it was different. I had few conversations about differentiating settings and we definetly want different settings for every language, but it won't be in IDEA X.
Main idea that most of people use same code style settings for all languages, so there should be simple way to pick setting about C-Style braces in one place and use it in Java, Groovy, Scala and etc.
I'll think about your case, maybe I'll find solution for you or general solution.

Best regards,
Alexander Podkhalyuzin.

0

"This settings are same for all languages. It's strange that for Scala it was different."
they were not, i just wanted scala to use a different formatting rule that for java. i think i'm a special case here.

0

For a general solution I would suggest a hierarchical setup:
Generic settings, as now, at the top.
One layer below, have language specific settings that can either default to the above settings, or override them.
Below that, have project-specific settings for each language, to deal with specific formatting conventions that may be enforced by a project.
Below that, optionally, module-specific settings for each language.

You might even carry that further by allowing directories or individual files to override language settings.

Kind regards,
Maarten

0

Yes, I think this way will be the best one (except maybe file or directory based settings), but I'm sure that it won't be in IDEA X, sorry.

Best regards,
Alexander Podkhalyuzin.

0

The problem that i have right now with todays nightly build is that it formats in a strange way.

I do wicket development with Scala and I have code that looks like this:

target.appendJavascript(new Effect.Appear(wrapper).toJavascript)



it gets formatted to something strange like this:

target.appendJavascript(new Effect.Appear(wrapper)               .toJavascript)



So whats the deal? What formatting options should I resolve to? The "old" Scala ones or the unified general ones? What settings have to be changed in order for such statements to survive the formatter? What effects will the changes (to be made) impose on my Java code?

Oh and by the way I like to have short method bodies. I do not like the new formatter that seemingly puts blank lines after every opening brace it finds... until now "if then else" did never take up so much space...

0

There has been a bug reported. The formatter is still being reworked, so you're unlucky enough to have picked a nightly that isn't so stable for this feature.

0

Please sign in to leave a comment.