簡體   English   中英

如何阻止 Eclipse 的格式弄亂我的代碼?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM