IDEA自动格式化代码

1、settings -> plugins 选择 Browse repositories…

技术分享图片

2、搜索google-java-format 和 Save Actions,安装

技术分享图片

3、重启IDE,启用google-java-format

技术分享图片

4、 启用Save Actions

保存时自动格式化 ,将没用的import 语句删除

技术分享图片