How to stop the eclipse format from messing up my code?

For some reason, Eclipse started messing up my code when I was CTRL + SHIFT + Fformatting. Any line longer than 80 characters is wrapped, and the lines with comments at the end are really mixed up.

To CTRL + SHIFT + F:

projectile.setPosition((CAMERA_WIDTH / 2) - (projectile.getWidth() / 2), 800);//projectile center is set to middle of screen at bottom

After CTRL + SHIFT + F:

    projectile.setPosition(
            (CAMERA_WIDTH / 2) - (projectile.getWidth() / 2), 800);// projectile
                                                                    // center
                                                                    // is
                                                                    // set
                                                                    // to
                                                                    // middle
                                                                    // of
                                                                    // screen
                                                                    // at
                                                                    // bottom

In Window > Preferences > General > Editors > Text Editorsmy Print margin columnset to 150, and it is the only preference that I have changed. Even when I restore the defaults, Eclipse still messed up my code.

How do I change this feature?

+3
source share
2 answers

, . .

+2

, , Window > Preferences > Java > Code Style > Formatter. , Line Wrapping Maximum line width.

+2

All Articles