[英]How do I stop Eclipse's format from messing up my code?
For some reason Eclipse has started messing up my code when I CTRL + SHIFT + F
to format.出于某种原因,当我
CTRL + SHIFT + F
格式化时,Eclipse 开始弄乱我的代码。 Any line longer than 80 characters is getting wrapped, and lines with comments at the end really get messed up.任何超过 80 个字符的行都会被换行,最后带有注释的行真的会被弄乱。
Before CTRL + SHIFT + F
:在
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
:在
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 Editors
my Print margin column
is set to 150 and that is the only preference I have changed.在
Window > Preferences > General > Editors > Text Editors
中,我的Print margin column
设置为 150,这是我更改的唯一首选项。 Even when I restore defaults Eclipse still messes up my code.即使我恢复默认值 Eclipse 仍然会弄乱我的代码。
How do I change this feature?如何更改此功能?
Just adjust the formatter settings to your personal preferences and gusto and you are set.只需根据您的个人喜好和喜好调整格式化程序设置即可。 There are LOTS of options and line wrap and line width are some of them
有很多选项,换行和线宽是其中的一些
The preference you want is under Window > Preferences > Java > Code Style > Formatter
.您想要的首选项位于
Window > Preferences > Java > Code Style > Formatter
下。 Edit the profile, go to the Line Wrapping
tab, and set the Maximum line width
.将配置文件 go 编辑到
Line Wrapping
选项卡,然后设置Maximum line width
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.