views:

179

answers:

2

Is there a way to stop eclipse from mangling the comments in my source files?

My main issue is stopping it from word wrapping them. I've managed to configure eclipse to not word wrap any code but it still seems to do it to comments.

Code that I enter like this:

public int myVariable = 100; // this variable is a very interesting variable and it does lots of stuff

End up like this:

public int myVariable = 100; // this variable
                             // is a very
                             // interesting
                             // variable and
                             // it does lots
                             // of stuff
+4  A: 
  1. Go to Preferences -> Java -> Code Style -> Formatter
  2. There edit the profile and switch to the last tab called "Comments"
  3. Uncheck the "Enable line comment formatting"
Simon Lehmann
+3  A: 

Go to the "Window" menu -> preferences
choose the editor you're interested in from the list on the left.(e.g. Java)
then there should be a subsection called "Code Style", and under that "Formatter".

Then you'll need to create a new formatter profile. (The built-in profile can't be edited) On the last tab of the profile configuration is options for comment formatting

Jonathan Fingland