Did anyone create the Java Code Formatter Profile for Eclipse IDE that conforms to the Android Code Style Rules?

不想你离开。 提交于 2019-12-20 08:07:57

问题


Android Code Style Guide defines "Android Code Style Rules".
To conform to these rules one have to change quite a number of settings of the Java Code Formatter (Window->Preferences->Java->Code Style->Formatter) default profile (in Eclipse IDE).

Did anyone manage to configure the formatter to follow the "Android Code Style Rules" already?
If yes, please export the Formatter profile and publish to be used by community.

PS: I've tried to do this myself but I've found that there are too many formatter options available, and most of them are not mentioned in the Code Style Guide :-(


回答1:


There are pre-made formatter rules available from the platform/development.git repository (GitHub mirror, in folder /ide/eclipse).

So you can simply import android-formatting.xml and android.importorder as mentioned here.




回答2:


On a related note, here's how developers around Google keep their various Eclipse instances all in agreement: Workspace Mechanic for Eclipse




回答3:


I think personal or team preferences vary to much to globally enforce a coding style. So every body should deploy his project specific coding style.




回答4:


The link in kroimon's answer to android formatter rules is broken. Here is the correct one.




回答5:


Sync the source code according to these instructions. The formatting guidelines are in the file development/ide/eclipse/android-formatting.xml. You can import it with Eclipse.

Menu bar -> Window -> Preferences -> Java -> Code Style -> Formatter -> Import

Point it to the path of the android-formatting.xml



来源:https://stackoverflow.com/questions/2480596/did-anyone-create-the-java-code-formatter-profile-for-eclipse-ide-that-conforms

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