Eclipse Code Formatter Plugin

主宰稳场 提交于 2019-12-22 08:07:05

问题


Can some one suggest me a plugin to format HTML and JAVA code with proper indents etc ? Is there any built in option there in Eclipse ?


回答1:


Eclipse does have built in Java formatting:

Preferences > Java > Code Style > Formatter

For HTML, you might try something like HTML Tidy. The Web Tools Platform project also includes formatting.




回答2:


Use Source -> Format or CTRL+SHIFT+F




回答3:


It's a combination of all the answers above, which suits me-

  1. Go to Preferences > Java > Code Style > Formatter and set all the options you want by creating your own profile or using a default one. Personally I find the line-wrap limited to 80 a little too low. I set it to 200.
  2. Save the 'custom' preferences by giving it a new profile name (export it for future restoration)
  3. Select the code in your editor - then hit CTRL+SHIFT+F. That should format your code.

Worked wonders for me everytime.




回答4:


Java code formatting is built in. Go to Window->Preferences->Java->Code Style->Formatter. There's a built in profile set up and you can make your own.




回答5:


http://sourceforge.net/projects/jalopy/

Note that Jalopy has its settings under Window> Jalopy Preferences.

(This menu option appears only when all editor tabs are closed)

Eclipse doesn't have proper built-in code formatting. You might want to open your project in Idea IntelliJ or Netbeans and use their formatting to do a thorough job on it.



来源:https://stackoverflow.com/questions/5473905/eclipse-code-formatter-plugin

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