Steve
Steve

Reputation: 2816

How to keep eclipse from wrapping multiline comments /*...*/ in Java?

How do I keep eclipse from wrapping multiline comments in Java when using /* ... */?

For example, Eclipse will take this:

/*
// Old code, don't use
for( int i = 0; i < myarray.length(); i++){
        myarray[i].haveFun();
}
*/

And turn it into this:

/*
// Old code, don't use for( int i = 0; i <  
myarray.length(); i++){  myarray[i].haveFun();
}
*/

Upvotes: 0

Views: 127

Answers (3)

Vytenis Bivainis
Vytenis Bivainis

Reputation: 2376

Eclipse formatter -> "Off/On Tags" -> Enable. Then use comments, for example:

// @formatter:off
...
// @formatter:on

Upvotes: 2

greg-449
greg-449

Reputation: 111142

Go to Preferences > Java > Code Style > Formatter and select Edit... on the active profile.

Switch to the Comments tab and enter a large value for the Maximum line width for comments value

Upvotes: 1

Josh Horowitz
Josh Horowitz

Reputation: 665

http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse

The article explains how to do exactly what you want and more.

Upvotes: 0

Related Questions