Eclipse API 美化 Groovy Script 代码 [英] Eclipse API to beautify Groovy Script code

查看:15
本文介绍了Eclipse API 美化 Groovy Script 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了 Eclipse 代码格式化程序 Eclipse 代码格式化程序 为我的 Web 项目要求格式化 Java 代码.现在我正在为 Groovy 寻找类似的东西.谁能告诉我如何对 Groovy 做同样的事情?

I tried the Eclipse code formatter Eclipse code for-matter to format Java code for my web project requirement. Now I am looking for something similar for Groovy. Can any one tell me how do the same for Groovy as well?

推荐答案

没有语法高亮那么郁闷...!

No syntax highlighting is so glum...!

Aaron D 建议使用 Eclipse Marketplace 对我不起作用:版本似乎已过时,安装尝试失败.这对我有用(霓虹灯,几个月后氧气)

Aaron D's recommendation to use the Eclipse Marketplace didn't work for me: versions out of date it seems, installation attempts failed. This is what worked for me (Neon, then Oxygen a few months later)

  • go here https://github.com/groovy/groovy-eclipse/wiki
  • under "Snapshot builds" (lower down than "Releases", which only go up to Eclipse Luna at time of writing), identify and copy the link for your Eclipse version
  • in Eclipse go Help --> Install new software
  • Work with --> paste: http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/ (from above site: correct version for Eclipse Neon) (2018-01-03 http://dist.springsource.org/snapshot/GRECLIPSE/e4.7/ : Oxygen)
  • click add
  • check the item "Groovy-Eclipse" --> Next --> Next --> Accept, Finish installed (took long time: progress indicated at bottom right)
  • restart of Eclipse
  • Window --> Prefs: there is now a "Groovy" item
  • Groovy --> Compiler --> Groovy Script Folders: checked "**/*.gradle"
  • Apply : "must do full build"...
  • restart Eclipse again
  • *.groovy and *.gradle : syntax highlighting! auto-formatting!

更新 2019-08,Eclipse 版本 4.12(2019-06")

此时没有要突出显示/选择的Groovy-Eclipse"项目!我的实验似乎表明,在安装"对话框中,您必须检查主包"和Maven 支持".

At this point there is no "Groovy-Eclipse" item to highlight/choose! My experiments seem to show that in the "Install" dialog you have to check the "Main package" and the "Maven support" thing.

OTOH 似乎 .gradle 文件可以直接使用这个编辑器,不需要配置.

OTOH it seems that .gradle files then work with this editor out of the box, no config needed.

感谢您让它变得更加混乱和不言自明,伙计们!

Thanks for making it a little bit more confusing and less self-explanatory, guys!

这篇关于Eclipse API 美化 Groovy Script 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆