Eclipse 代码格式化插件
有人可以建议我一个插件来格式化 HTML 和 JAVA 代码并具有适当的缩进等吗? Eclipse 中有内置选项吗?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
使用源->设置格式或 CTRL+SHIFT+F
Use Source -> Format or CTRL+SHIFT+F
Eclipse 确实内置了 Java 格式设置:
Preferences >爪哇>代码风格> Formatter
对于 HTML,您可以尝试类似 HTML Tidy 的东西。 Web 工具平台 项目还包括格式设置。
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.
这是上面所有答案的组合,适合我 -
Preferences >爪哇>代码风格>格式化程序
并通过创建您自己的配置文件或使用默认配置文件来设置您想要的所有选项。我个人认为将换行限制为 80 有点太低了。我将其设置为 200。CTRL+SHIFT+F
。这应该格式化你的代码。每次都为我创造奇迹。
It's a combination of all the answers above, which suits me-
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.CTRL+SHIFT+F
. That should format your code.Worked wonders for me everytime.
内置 Java 代码格式化。转到“窗口”->“首选项”->“Java”->“代码样式”->“格式化程序”。有一个内置的配置文件设置,您可以创建自己的配置文件。
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/
请注意,Jalopy 的设置位于 Window> 下。老爷车首选项。
(此菜单选项仅在所有编辑器选项卡关闭时出现)
Eclipse 没有正确的内置代码格式。您可能想在 Idea IntelliJ 或 Netbeans 中打开您的项目,并使用它们的格式对其进行彻底的处理。
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.
您可以在 Eclipse 中使用 Prettier Formatter Plugin 比内置 eclipse formatter 更好地格式化代码
单击此链接:https://marketplace.eclipse.org/content/prettier-formatter
You can use Prettier Formatter Plugin in Eclipse to format your code better than inbuild eclipse formatter
Click this link: https://marketplace.eclipse.org/content/prettier-formatter