code formatter for grails and Groovy? [closed]
Asked Answered
X

6

7

I'm currently using a basic text editor to write my grails code. Does anyone know of a program that will automatically format code with indentation similar to indent does for C? I'd rather use a commandline program to do this but can use an IDE to format my code if that's the only option.

Xanthophyll answered 24/6, 2009 at 13:18 Comment(0)
S
2

Try NetBeans v.6.7 (not the current production release 6.5) with the NetBeans Groovy/Grails plugin enabled. This is a nice clean IDE interface (easier to use than Eclipse IMHO), and you can set it up to integrate with your Grails installation. You can call all your Grails tasks from the IDE, edit your code, test and run your project. Then, if you want to format your code, you just right-click in the code editor and select "Format". Easy!

Sherilyn answered 25/6, 2009 at 9:40 Comment(1)
Using NetBeans 6.7 FCS, there are still some issues. The one I find most frustrating is the IDE parsing Groovy as if it were Java, and flagging "errors" which are not errors in Groovy files. The file runs fine, but it is annoying to see false errors while editing. Calling Groovy classes from Java is another instance in which false errors are reported. If you can live with this, it is quite usable.Hooey
M
1

I am using VIM / GVIM for typing code in Groovy/Grails. it has code formatting, I just need to tell my VIM that groovy and java are similar....

and then press gg = G [enter] (format from top to bottom)

Marcheshvan answered 25/6, 2009 at 5:18 Comment(0)
A
0

There is a tool recommended in this thread for this purpose. I have not tried it but maybe worth a look.

Antipodes answered 24/6, 2009 at 13:28 Comment(1)
That tool is only available for the windows platform. Project is likely dead and abandoned.Neoplatonism
S
0

Here's some instructions on how to get Grails working with NetBeans (couldn't submit the second URL in my last post).

Sherilyn answered 25/6, 2009 at 9:44 Comment(0)
E
0

the groovy eclipse plugin does a decent job of formatting groovy code. sts might be smarter about some of the grails code.

Equate answered 27/4, 2010 at 3:18 Comment(0)
H
0

You can use npm-groovy-lint for command line, and VsCode Groovy Lint in Visual Studio Code IDE :)

https://www.npmjs.com/package/npm-groovy-lint

https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint

Headstock answered 21/5, 2020 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.