IDE Settings - shenliuyang/development GitHub Wiki
本篇只包括对Eclilpse的设置,其它IDE暂不提供,请按照此规则查找相应的设置。
字符集编码一律采用UTF-8,Preferences→ General → Workspace → Text file encoding,改为UTF-8
- 导入代码格式与Cleanup规则(Preferences→Java Code Style, Formatter文件 Cleanup文件 ).
- 手工修改warning设置 (Preferences→ Java→Compiler→Warining),修改详细规则见后面的"Java→Compiler→Warining".
- 设置保存代码时的自动操作, 包括:format source code→all lines,与Organize Imports。(Preference→Java→Editor→SaveAction)
- 调整与输入法切换 冲突的内容助手热键.(Preference→General→Keys, 找到CoAssistntent , 改为诸如Shift+Space,习惯了用Alt+/的也可以不改)
- 取消XML缺少DTD的warning 并设置XML每行长度为120字符, 并设置XML缩进为1个Tab(Preference→XML→XML Files).
- 取消spell checking (Preference→Genernal→Editors→TextEditors→Spelling)
- 设置html/jsp页面每行长度为120字符,并设置JSP缩进为1个Tab(Preference→Web→JSP Files→Editor→HTML)
- 在 Windows→Preferences→Java Code Style的Formatter 和 Cleanup 中导入 Formatter设置文件 cleanup-profile设置文件
- 修改Preference→General→Keys ,调整与输入法切换冲突的内容助手热键, 找到Content Assist, 改为诸如Shift+Space
- 修改Windows→Preference→Java→Editor→SaveAction, 选择Format Source Code,Formate All Codes,与Organize Imports
- 修改Windows→Preferences→XML→XML Files→Editor ,增加到120字符
- 修改Windows→Preferences→XML→XML Files, 取消XML缺乏DTD的warning;
- 修改 Windows→Preferences→Genernal→Editors→TextEditors→Spelling 取消spell checking,
每行增至120字符 (Line wrapping)
取消三个 Comment Format (Comments) —因为Eclipse的Formatter不能自由换行,老把注释搞成一行的缘故
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Remove unused imports
- Add missing ‘@Override’ annotations except implementation of interface methods
- Add missing ‘@Deprecated’ annotations
- Remove unnecessary casts
- Remove unnecessary ‘$NON-NLS$’ tags
- Convert control statement bodies to block(Code Style)
- Convert for loops to enhanced for loops (Code Style)
- Organize imports (Code Organizing)
- Format source code (Code Organizing)
- Remove trailing whitespaces on non empty lines(Code Organizing)
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
- 增加全部
- File-Settings-plugins search in repository “SaveAction”,“Lombok” install and restart idea
- File-Settings SaveAction. 勾选"Activate save actions on save", “Organize imports” “Reformat file”