Eclipse Code Formatter Plugin
题
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 ?
解决方案
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.
其他提示
Use Source -> Format or CTRL+SHIFT+F
It's a combination of all the answers above, which suits me-
- 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. - Save the 'custom' preferences by giving it a new profile name (export it for future restoration)
- Select the code in your editor - then hit
CTRL+SHIFT+F
. That should format your code.
Worked wonders for me everytime.
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.
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.