Eclipse, GitHub - Text Format / Tab Indent Problem

故事扮演 提交于 2021-02-19 05:37:05

问题


i'm using an Eclipse based editor (Flash Builder) to write my code. i want to use GitHub as a remote repository but there are formatting conflicts caused by the tab indents.

for example, in Flash Builder, i have written this:

case Boolean:       bytes.writeBoolean(value);          break;                  
case int:           bytes.writeInt(value);              break;
case uint:          bytes.writeUnsignedInt(value);      break;
case Number:        bytes.writeDouble(value);           break;
case ByteArray:     bytes.writeBytes(value);            break;
default:            bytes.writeUTFBytes(value);

but when that is sent to GitHub (or a plain text file), it is displayed something like this:

case Boolean:       bytes.writeBoolean(value);          break;
case int:                bytes.writeInt(value);                 break;
case uint:               bytes.writeUnsignedInt(value);     break;
case Number:        bytes.writeDouble(value);           break;
case ByteArray:     bytes.writeBytes(value);            break;
default:                 bytes.writeUTFBytes(value);

if i pull the repository from GitHub and open the files in the code editor, the format is still correct so it doesn't seem to change the format, rather it's displaying it incorrectly.

is this something that's possible to fix?


回答1:


Sounds like you are using tabs as delimiter and different editors have different tab spaces. That is why I always use (4) spaces instead of tabs. You can configure Eclipse to always use spaces by checking:

Window->Preferences->General->Editors->Text Editors->Insert spaces for tabs


来源:https://stackoverflow.com/questions/6726358/eclipse-github-text-format-tab-indent-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!