google-java-format plugin should intercept the “Reformat Code” action in IDEA (Ctrl+Alt+L) and apply its own rules. However, it does not work with imports for some reason, so to fix that you have to import a Java Google Code Style XML file  to your code style settings in IDEA.

1.下载Google Java Code Style在IntelliJ中的配置文件 https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
2.选择”File”菜单组下的”Settings”菜单项:
3.选择”Editor->Code Style”菜单项,并点击图示的”Intellij IDEA code style XML”导入第1步中下载的配置文件(可修改导入的配置名,此处使用默认的”GoogleStyle”):

4.将当前项目的”Schema:”设置为第3步中导入的”GoogleStyle”

5.”Editor->Code Style->Java->Imports->Names count to use static import with *”菜单项, 输入1

6.Install google-java-format plugin (File -> Settings -> Plugins -> Browse repositories -> search for “google-java-format” and install)

After installation, the plugin has to be enabled per-project (it is disabled by default). To do that, open your project and go to File -> Settings -> Other Settings -> google-java-format Settings and check “Enable google-java-format”

最新文章

  1. linux内核分析作业4:使用库函数API和C代码中嵌入汇编代码两种方式使用同一个系统调用
  2. APP开发流程
  3. [转载]ASP.NET中TextBox控件设立ReadOnly="true"后台取不到值
  4. 我的Sharepoint表单使用
  5. hdu 5294 最短路+最大流 ***
  6. 【原】iOS动态性(一):动态添加属性的方法——关联(e.g. 向Category添加属性)
  7. 【Leetcode】Reorder List JAVA
  8. 关于C语言中运算符优先级的一次错误
  9. C#经典系列-跨语言
  10. Java与C#的语法区别(不断更新中...)
  11. iOS错误之-Presenting view controllers on detached view controllers is discouraged
  12. 算法模板——平衡树Treap
  13. 表达式求值(栈方法/C++语言描述)(三)
  14. arguments.callee的临时指向特性
  15. C#中Activator.CreateInstance()方法用法分析
  16. APP微信支付报错《商户号该产品权限未开通,请前往商户平台>产品中心检查后重试》
  17. Leetcode 20.有效的括号 By Python
  18. 3、Sql-Ora-01033:oracle initialization or shutdown in progress
  19. SQL删除指定条件的重复数据,只保留一条
  20. FireDAC 下的 Sqlite [2] - 第一个例子

热门文章

  1. SVN资源库报错:Could not create the view: org.tigris.subversion.subclipse.ui.repository.RepositoriesView
  2. Hadoop的Writerable在Spark无法序列化的问题
  3. java全栈day13----Eclipse项目的jar包导出与使用jar包
  4. leetcode mergeKsortedlink
  5. iOS组件化方案
  6. OpenStack部署的简单模型
  7. [Django笔记] views.py 深入学习
  8. bzoj3140: [Hnoi2013]消毒(二分图)
  9. web安全-点击劫持
  10. P4196 [CQOI2006]凸多边形 半平面交