Eclipse API 美化 Groovy Script 代码 [英] Eclipse API to beautify Groovy Script code
问题描述
我尝试了 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)
- 去这里https://github.com/groovy/groovy-eclipse/wiki一个>
- 在Snapshot builds"下(低于Releases",在撰写本文时仅会出现在 Eclipse Luna)下,识别并复制 Eclipse 版本的链接
- 在 Eclipse 中转到帮助 --> 安装新软件
- 使用 --> 粘贴:http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/(来自上述站点:Eclipse Neon 的正确版本)(2018-01-03 http://dist.springsource.org/snapshot/GRECLIPSE/e4.7/:氧气)
- 点击添加
- 检查项目Groovy-Eclipse"-->下一步-->下一步-->接受,完成安装(花了很长时间:右下角指示进度)
- 重启 Eclipse
- Window --> Prefs:现在有一个Groovy"项
- Groovy --> 编译器 --> Groovy 脚本文件夹:选中**/*.gradle"
- 申请:必须进行完整构建"...
- 再次重启 Eclipse
- *.groovy 和 *.gradle :语法高亮!自动格式化!
- 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屋!