Groovy formatter/beautifier in Visual Studio Code

2020-05-31 16:55发布

For supported files in VSCode we get an option (when you right click on the file editor) to Format Document (ALT+SHIFT+F).

But unfortunately for Groovy this option is not available. And according to the VSCode community, there are no plans to implement this feature.

Is there an alternative solution available, specifically for VSCode?

3条回答
太酷不给撩
2楼-- · 2020-05-31 17:09

There is now a Visual Studio Code extension to Lint, Format and Auto-fix Groovy and Jenkinsfiles ! :)

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

查看更多
beautiful°
3楼-- · 2020-05-31 17:11

It would only be available via an extension, which you can search for in the marketplace.

Unfortunately it doesn't look like there are many extensions for Groovy at all. And if that can be considered an indication of the language's popularity, it's highly unlikely that broad support would ever be added to VS Code out of the box.

查看更多
家丑人穷心不美
4楼-- · 2020-05-31 17:13

I don't know how well this works for formatting other than indentation, but I simply changed the file extension from .groovy to .js, right clicked in the file, and selected "Format Document". It fixed the indentation for me.

查看更多
登录 后发表回答