[英]How do you copy java code from a java file from eclipse without messing up the format?
[英]How do I stop Eclipse's format from messing up my code?
出於某種原因,當我CTRL + SHIFT + F
格式化時,Eclipse 開始弄亂我的代碼。 任何超過 80 個字符的行都會被換行,最后帶有注釋的行真的會被弄亂。
在CTRL + SHIFT + F
之前:
projectile.setPosition((CAMERA_WIDTH / 2) - (projectile.getWidth() / 2), 800);//projectile center is set to middle of screen at bottom
在CTRL + SHIFT + F
之后:
projectile.setPosition(
(CAMERA_WIDTH / 2) - (projectile.getWidth() / 2), 800);// projectile
// center
// is
// set
// to
// middle
// of
// screen
// at
// bottom
在Window > Preferences > General > Editors > Text Editors
中,我的Print margin column
設置為 150,這是我更改的唯一首選項。 即使我恢復默認值 Eclipse 仍然會弄亂我的代碼。
如何更改此功能?
只需根據您的個人喜好和喜好調整格式化程序設置即可。 有很多選項,換行和線寬是其中的一些
您想要的首選項位於Window > Preferences > Java > Code Style > Formatter
下。 將配置文件 go 編輯到Line Wrapping
選項卡,然后設置Maximum line width
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.