以编程方式在java文件上调用intellij代码格式化程序 [英] Invoke intellij code formatter programmatically on java files

查看:120
本文介绍了以编程方式在java文件上调用intellij代码格式化程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在磁盘上的任意源文件上以编程方式调用intellij的java源代码格式化程序?

How can I programmatically invoke intellij's java source code formatter on an arbitrary source file on disk?

我不介意编写插件来执行此操作但是如果有的话是一种从命令行调用格式化程序的方法很棒!

I don't mind writing a plugin to do this but if there is a way to invoke the formatter from command line that would be great!

谢谢

推荐答案

我最终编写了自己的插件,可以在 github 上找到。请注意,它可能需要更精细的调整

I ended up writing my own plugin which is available on github. Note that it might need some more fine tuning

这篇关于以编程方式在java文件上调用intellij代码格式化程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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