Questions tagged [eclipse-formatter]

The Eclipse Code Formatter is a tool for performing automatic styling of code in Eclipse.

The Eclipse Code Formatter is a tool to automatically format code in Eclipse. It can be configured manually to meet the developer's requirements. Eclipse has a page about it in the help section.

45 questions
527
votes
14 answers

How to turn off the Eclipse code formatter for certain sections of Java code?

I've got some Java code with SQL statements written as Java strings (please no OR/M flamewars, the embedded SQL is what it is - not my decision). I've broken the SQL statements semantically into several concatenated strings over several lines of…
Greg Mattes
  • 33,090
  • 15
  • 73
  • 105
44
votes
4 answers

Best Eclipse Code Formatters?

The default Eclipse formatter formats my Java code in a really funny way. For example: hello.show().x().y() would oddly be formatted as x() and .y(), and be placed on a separate line. Are there any other basic formatters that can do a better job?…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
35
votes
4 answers

Stop eclipse from line wrapping?

Is there a way to get eclipse to stop erasing existing line breaks? If I have a method signature like this, I can't figure out how to get eclipse to leave it alone: void foo( int arg1, int arg2, int arg3, int arg4) { //…
Craig P. Motlin
  • 26,452
  • 17
  • 99
  • 126
16
votes
2 answers

How to force the Eclipse Mars 4.5 formatter not to join already wrapped lines?

I've just moved from eclipse Kepler to eclipse Mars and my Java formatter seems not to behave the same way anymore. I used to be able to do the following: object .method1() .method2() .method3(); The formatter would keep my code like…
Crystark
  • 3,693
  • 5
  • 40
  • 61
14
votes
4 answers

Importing code style formatting settings into eclipse from intellij-idea

I've recently implemented the maven Check style plugging into my project and have changed all of the formater Settings in intellij (Which I use) to conform to this style guide (which they now do). However I need to produce a settings .xml file for…
Luke_P
  • 659
  • 2
  • 7
  • 23
12
votes
2 answers

Auto updating formatter in Eclipse

We rely on Eclipse formatter in our project to enforce formatting conventions for us. It works great and we really like it. We keep the formatter file with our project in source control and ask everybody to import this formatter to Eclipse. The…
Piotr Sobczyk
  • 6,443
  • 7
  • 47
  • 70
8
votes
1 answer

Eclipse code formatter multiline function call closing bracket indention

Currently my eclipse formatter formats a multiline function call like this: someObject.doSomething( some().long().chain().of().methods() ); But what I want is for eclipse to align the closing bracket with the method…
Reins
  • 1,109
  • 1
  • 17
  • 35
6
votes
2 answers

How to avoid reordering when optimize imports

Is there a way to prevents Intellij Idea to rearrange imports when it runs the optimize imports? I want to avoid this since I work on a large codebase where most of others programmers are using Eclipse. When Idea do the optimization (to remove…
alexpfx
  • 6,412
  • 12
  • 52
  • 88
6
votes
1 answer

Eclipse formatter split long String

Is there a way to tell Eclipse formatter that when a String is too long, it should split it with + to fit the maximum line width automatically? For instance, if my max line width is 80, I'd like this: String s = "This is a very very very very very…
carcaret
  • 3,238
  • 2
  • 19
  • 37
5
votes
1 answer

Configure Eclipse Formatter with m2e

is there any existing m2e-extension to configure Eclipse Formatter when importing a Maven project into eclipse? We are using custom checkstyle rules and m2eclipse configures the Eclipse-CS-plugin for us. But in addition I want the Eclipse Formatter…
tomkani
  • 61
  • 2
4
votes
1 answer

Eclipse Formatter - Wrapped parenthesis each on new line

I would like to be able to customize Eclipse's formatter so that (where necessary) blocks wrapped by parenthesis can be formatted such that both the opening and closing parenthesis are on their own lines. (Like Allman style but for parenthesis…
Zout
  • 821
  • 10
  • 18
4
votes
2 answers

Eclipse default custom formatter

Eclipse allows the ability for you to customize code formatters and export/import them. Is there a way for me to create a formatter, save it in source control, and set a property somewhere that will load that into eclipse automatically when you open…
nmb1106
  • 385
  • 1
  • 5
  • 20
3
votes
1 answer

Documentation on Eclipse Code Formatter Xml

I'm looking to find a good source of documentation on the different parameters in the eclipse code formatter. I've found some good examples of specific parameters on stack overflow but can't find any comprehensive parameter list or a list of…
3
votes
2 answers

Vscode eclipse formatter setting to align method parameters

Which eclipse-formatter setting in vscode will accomplish the following formatting, focusing specifically on the parameter alignment? Current public ResponseEntity retrieveAgreement(final String one, final Long someId, final Long…
Albert Scholtz
  • 337
  • 3
  • 15
3
votes
1 answer

Eclipse neon: java formatter keeps spaces on empty lines?

Within our team, we have an eclipse formatter profile that we are using for some years. It seemed to work fine within Eclipse Neon, but today I discovered that the formatter is no longer "trimming" empty lines. When using older versions of eclipse,…
GhostCat
  • 137,827
  • 25
  • 176
  • 248
1
2 3