C0deAttack
C0deAttack

Reputation: 24667

Eclipse custom formatting

I'm trying to create a JAVA code formatter such that it doesn't wrap any lines. BUT for any lines in my code that I have manually wrapped I want the formatter to respect them and not format them in to one line.

For example:

public Class {
    public Class(String a,
                 String b,
                 String c,
                 String d) {
         // The constructor arguments should stay as they are

    }

    public void aMethod() {
        // This statement should not be wrapped
        get().doSomething().getAnohterMethodThatHasAReeeeeeeaalllyyLongName();
    }
}

I have made the line width 9999 (the max), and I have turned off line wrapping for everything. What have I missed?

Thanks.

Upvotes: 1

Views: 4989

Answers (1)

Markus Lausberg
Markus Lausberg

Reputation: 12267

I opened the preference page for "Java - Code Style - Formatter"

and activated "never join lines" and selected "Do not wrap" in the combo box "line wrapping policy"

After this change i was able to write code, which was not wrapped.

Upvotes: 8

Related Questions