簡體   English   中英

如何從 java 文件中復制 java 代碼而不弄亂格式?

[英]How do you copy java code from a java file from eclipse without messing up the format?

我一直在嘗試從我的 eclipse 程序中復制代碼,以便我可以將 email 代碼復制給與我一起工作的人,但格式混亂了。 這就是我想要的樣子:

while (insOrDel) {// Asks the user for five different options:
            // add a username or bot
            // add a special username or bot
            // remove a username or bot
            // remove a special username or bot.
            // list all special usernames or bots.
            // list all usernames or bots
            // run weblog sifter.

然而,當它從 email 中出來時,結果是這樣的:


        while (insOrDel) {// Asks the user for five different options:
// add a username or bot
// add a special username or bot
// remove a username or bot
// remove a special username or bot.
// list all special usernames or bots.
// list all usernames or bots
// run weblog sifter.

請記住,這是在 Ctrl+Shift+F 之后,並且由於某種原因,注釋沒有縮進。 有沒有辦法來解決這個問題?

謝謝!

當源文件使用制表符並且您粘貼代碼的目標應用程序具有不同的制表符寬度時,可能會發生這種情況。

為避免這種情況,您可以在 Eclipse / Window / Preferences / General / Editors / Text Editors中設置選項“為制表符插入空格”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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