idea 2020.1日常使用小总结

IDEA 2020.1

本文记录IDEA 2020.1 的日常开发使用的小技巧总结。持续更新中……

idea 2020.1修改格式化代码快捷键

  1. File --> Setting,见下图:

在这里插入图片描述

  1. 然后在右边搜索栏输入:reformat code

在这里插入图片描述

  1. 将被检索出来的东西右键,然后add key board shortcut,然后修改你自己熟悉的快捷键就行了。最后,OK退出。

在这里插入图片描述


Intellij IDEA 代码格式化与eclipse保持风格一致

  1. 选择File --> Setting --> Plugins --> Marketpalce,在setting中安装插件eclipse code Fromatter。安装好重启IDEA2020,即如下图所示。

在这里插入图片描述

  1. 下载所需的文件,本文采用的阿里的eclipse代码规范

在这里插入图片描述

  1. 选择Setting --> Eclipse Code Formatter,勾选 Use the Eclipse-code-formatter,并在Eclipse Formatter config file选择Eclipse用的eclipse-codestyle.xml文件,这个选项会决定格式化代码的方式。同时配置Import order的From File也为Eclipse用的eclipse-codestyle.xml文件,这个选项会决定组织import区域的方式。如下图:

在这里插入图片描述

在这里插入图片描述

4.使用插件
使用IDEA的格式化快捷键"Ctrl+ALT+L"即可进行格式化。这个是默认的,可以修改为个人快捷键。
如果出错会输出提示到Event Log里;如果看到’xxx formatted sucessfully by Eclipse code formatter'则表示格式化成功。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_46153949/article/details/111744183