前几期的IDEA新手入门知识太过庞杂,这一期对其进行汇总整理,总结出几个重要常用的settings更改点
1.UI Options
路径:Settings -> Appearance & Behavior -> Appearance -> UI Options
(1)Smooth scolling勾选,让你的屏幕上下滚动更平滑,不然会以整行的间隔滚动
(2)Drag-and-drop with Alt pressed only勾选,避免你误触拖动文件,当你想拖动文件时需要按下Alt才能使用鼠标左键拖动
2.New UI
路径:Settings -> Appearance & Behavior -> Appearance -> New UI
(1)Enable new UI勾选,这是启动IDEA新版UI界面的地方
(2)Show tool window names勾选,会显示你IDEA中工具栏的工具名称,避免第一次使用不认识
3.Data Formats
路径:Settings -> Appearance & Behavior -> System Settings -> Data Formats
(1)override System date and time format勾选,然后将Date format格式dd-MM-yyyy改为yyyy-MM-dd,还是选择Use 24-hour time,其它不动
4.Updates
路径:Settings -> Appearance & Behavior -> System Settings -> Updates
(1)Check for Updates可以直接检查你的插件更新或者一些新版本的补丁,无需到官网上再下载
5.Auto import
路径:Settings -> Editor -> General -> Auto import
找到Java,下面有Show auto-import tooltip for 勾选Classes和Static methods and fields
Insert imports on paste后选择Ask
Add unambiguous imports on the fly勾选,这个会让你在粘贴代码的时候,自动导入需要的包
Optimize imports on the fly勾选,这个会自动删除没有用到的包
同理其它的语言下也一样可以进行勾选
6.Appearance
路径:Settings -> Editor -> General -> Appearance
需要勾选的:
(1)show sticky lines while scolling: 5 max lines让你在代码上下翻动的时候会显示相关代码的信息
(2)show preview for intention actions when available显示意向预览
(3)use editor fond for inlay hints将代码块中的提示如 usage和参数的提示字体设置为和代码块相同字体格式
7.Breadcrumbs
(1)show breadcrumbs:bottom
(2)Language:勾选Java
8.Code Completion
路径:Settings -> Editor -> General -> Code Completion
(1)Automatically insert single suggestions for
Basic Completion 勾选,Type-Matching Completion勾选
Show suggestions as you type勾选,在你编写代码时也会显示建议
9.Editor Tabs
路径:Settings -> Editor -> General -> Editor Tabs
(1)Tab placement:可选择在顶部还是底部显示Tab选项
(2)show tabs in:勾选Multiple rows,勾选show pinned tabs in a seperate row、Mark modified,其它的应该是默认勾选的,如果没有勾选也都选上
(3)Close button position:可以选择Tab的关闭按钮X在左边还是右边
10.Code Editing
路径:Settings -> Editor -> Code Editing
(1)Current scope勾选上,剩下的两个Matched brace 和 Usages of element at caret也都勾选上
(2)Quick Documentation 勾选上
(3)Refactorings:勾选In modal dialogs,勾选show inline dialog for local variables
11.Code Style
路径:Settings -> Editor -> Code Style
(1)General:Hard wrap at 填选160,并勾选Wrap on typing
(2)点击Java,找到Wrapping and Braces:
四个Simple勾选上:Simple blocks in one line、Simple methods in one line、Simple lambdas in one line、Simple classes in one line
Ensure right margin is not exceeded勾选上,这个和Wrap on typing是相互照应的,两个都勾选才有作用
下面都是你自己在编辑代码时的风格:
例如if() statement如果我选择Force braces Always,就会强制性的加上{},不论if后面是几行代码
建议:
JavaDoc下的操作:
12.File Encodings
Globle Encoding 和 Project Encoding都选择UTF-8