IDE Settings - shenliuyang/development GitHub Wiki

IDE

本篇只包括对Eclilpse的设置,其它IDE暂不提供,请按照此规则查找相应的设置。

Eclipse 3.50以上 for JavaEE 环境配置

字符集

字符集编码一律采用UTF-8,Preferences→ General → Workspace → Text file encoding,改为UTF-8

代码格式设置概述

  1. 导入代码格式与Cleanup规则(Preferences→Java Code Style, Formatter文件 Cleanup文件 ).
  2. 手工修改warning设置 (Preferences→ Java→Compiler→Warining),修改详细规则见后面的"Java→Compiler→Warining".
  3. 设置保存代码时的自动操作, 包括:format source code→all lines,与Organize Imports。(Preference→Java→Editor→SaveAction)
  4. 调整与输入法切换 冲突的内容助手热键.(Preference→General→Keys, 找到CoAssistntent , 改为诸如Shift+Space,习惯了用Alt+/的也可以不改)
  5. 取消XML缺少DTD的warning 并设置XML每行长度为120字符, 并设置XML缩进为1个Tab(Preference→XMLXML Files).
  6. 取消spell checking (Preference→Genernal→Editors→TextEditors→Spelling)
  7. 设置html/jsp页面每行长度为120字符,并设置JSP缩进为1个Tab(Preference→Web→JSP Files→Editor→HTML)

配置详情

修改详情

  1. 在 Windows→Preferences→Java Code Style的Formatter 和 Cleanup 中导入 Formatter设置文件 cleanup-profile设置文件
  2. 修改Preference→General→Keys ,调整与输入法切换冲突的内容助手热键, 找到Content Assist, 改为诸如Shift+Space
  3. 修改Windows→Preference→Java→Editor→SaveAction, 选择Format Source Code,Formate All Codes,与Organize Imports
  4. 修改Windows→Preferences→XMLXML Files→Editor ,增加到120字符
  5. 修改Windows→Preferences→XMLXML Files, 取消XML缺乏DTD的warning;
  6. 修改 Windows→Preferences→Genernal→Editors→TextEditors→Spelling 取消spell checking,

Formatter的修改记录 (在Eclipse built-in 的基础上做出如下修改)

每行增至120字符 (Line wrapping)
取消三个 Comment Format (Comments) —因为Eclipse的Formatter不能自由换行,老把注释搞成一行的缘故

Cleanup的 修改记录

默认Cleanup
  1. Change non static accesses to static members using declaring type
  2. Change indirect accesses to static members to direct accesses (accesses through subtypes)
  3. Remove unused imports
  4. Add missing ‘@Override’ annotations except implementation of interface methods
  5. Add missing ‘@Deprecated’ annotations
  6. Remove unnecessary casts
  7. Remove unnecessary ‘$NON-NLS$’ tags
可选增加cleanup
  1. Convert control statement bodies to block(Code Style)
  2. Convert for loops to enhanced for loops (Code Style)
  3. Organize imports (Code Organizing)
  4. Format source code (Code Organizing)
  5. Remove trailing whitespaces on non empty lines(Code Organizing)

Java→Compiler→Warining

Code Style:

  • 增加Access to non-accessible member of enclosing type,Parameter assignment

Potential programming problem

  • 增加全部,除Boxing and UnBoxing

Name shadowing and confict

  • 增加全部

Unecessary Code

  • 增加全部,除Unecessary else

Annoatation

  • 增加全部

idea 配置

插件配置

  1. File-Settings-plugins search in repository “SaveAction”,“Lombok” install and restart idea
  2. File-Settings SaveAction. 勾选"Activate save actions on save", “Organize imports” “Reformat file”
⚠️ **GitHub.com Fallback** ⚠️