IDEA说明:
-
jetbrains公司出品。
旗下:webStorm:开发JS/HTML5/CSS3前端。
CLion:开发C/C++
DataGrip:开发数据库和SQL
AppCode:开发MAC/苹果手机ios 替换XCode
rubyMine:开发ruby/rails
Rider:开发.net
GoLand:开发Go。区块链
pyCharm:python语言。开发大数据,人工智能,数据分析,数据挖掘。 -
Android Studio:谷歌开发基于IDEA社区版迭代。
-
特点:智能代码助手,代码自动提示,重构,j2ee支持,ant,junit,maven,cvs,代码审查,创新GUI设计。
-
对jave,scala(大数据底层) and Groovy使用java类库,使用java虚拟机
与eclipse优势: -
强大的整合能力:比如:git,maven,sping等版本控制工具
-
提示功能快速、便捷
-
提示功能范围广对:jsp/js
-
好用的快捷键和代码模板(固定代码块)
-
搜索精准。
常用设置
A. idea 的toolbar/toolbuttons开启:view-appearance
ctrl+s在eclipse,idea实时保存
-
主题:setting-appearance&behaver-appearance-UI Option-Them
-
maven配置:setting-build、Execution、Deployment-build Tools-Maven(Maven home directory/User settings file/Local repository)
-
编辑区主题:setting-Editor-color Scheme
-
ctrl+滚轮放大缩小字体:setting-Editor-General—Change font size (zoom) with Ctrl+Mouse Wheel勾选
-
鼠标悬浮提示:setting-editor-code editing-show quick document on mouse move.
-
自动倒包:setting-editor-General—Auto import-java-all
手工倒包eclipse:ctrl+shift+O idea:alt+enter -
设置行号、方法间分隔符:setting-editor-General—appearance-show line numbers/show method separtors
-
写代码忽略大小写,都提示:setting-editor-General—cdoe completetion-去掉math case的?。
-
取消单行显示tabs操作,所有打开的的页签多行显示:setting-editor-General-Editor tabs-去掉show tabs in single row的?。
-
整体字体:editor-font
-
编辑框字体:editor-color Scheme-color Scheme font
-
控制台字体:editor-color Scheme-cosole Scheme
-
注释颜色:editor-color Scheme-language Defaults-comments-line comment/block comment(多行)
-
倒包,同包个数超过指定个数,改为*:editor-code style-java-imports
-
修改类头文档信息:editor-file and code templates-file header
-
项目文件编码:editor-file encodings-project encodings/default encoding for properties files:utf-8右侧也? transparent native-to-ascii conversion
import file乱码时:控制台右下角utf-8 reload(utf以gbk显示)、convert转换 -
设置自动编译:build/execution/deployment-compiler-build project automatically/compile independent modules in parallel的?。
eclipse:projcet-build automatically -
省电模式:file -power save mode关闭代码检查、提示功能
-
代码页签右键-split horizontally(水平)、split vertically(垂直)
-
idea自动加载HTML和JS页面设置:
-
Ctrl + Alt + S打开设置面板,build-compiler—勾选 Build project automatically选项
-
Ctrl + Shift + A查找registry命令: 在查找到的registry命令通过鼠标双击或敲回车键,在弹出的面板中找到并勾选compiler.automake.allow.when.app.running选项
-
spring boot 热部署下面的running Application Update Policies这两个要设置
-
-
若遇到 @Autowired 标记的变量出现 红色下划线,但是不影响 正常运行。可以进入 Settings,找到 Editor—Inspection,并选择其中的 Spring Core -> Code -> Autowiring for Bean Class,将 Error 改为 Warning,即可。
-
Idea 控制台不显示Services窗口
- 首先选择 Run - Edit configurations
- 然后选择Templates 在Configurations available in Services 下添加configuration types,点击+号选择添加Spring boot
代码模板
- editor-live Templates 可以定制(修改删除增加)
(iteration遍历,other条件判断,plain常量) - editor-General-Postfix Completion (使用现成的)同样的设置快一点(java)
常用的模板:
- main方法:eclipse main; idea:psvm+Tab
- System.out:eclipse sysout; idea:sout+Tab
变形(soutp(方法参数)/soutm(方法)/soutv(就近变量))/变量.sout/变量.soutv - for loop: fori(普通)
变形:增强 iter 、itar(普通) - List.for)(增强): (普通)list.fori正序 list.forr逆序(普通)
- if:
ifn :if(xxxnull)
inn :if(xxx!=null)
xxx.nn :if(xxx!=null)
xxx.null :if(xxxnull) - prsf:生成private static final
psf:生成public static final
快捷键设置
菜单栏:File-setting-keymap
下拉框选成eclipse
- 运行(run):Ctrl+Shift+F10
- 提示补全(class name completion):alt+/
- 单行注释:ctrl+/
- 多行注释:ctr+Shift+/
- 向下复制一行(Duplicate lines):ctr+alt+MumPad 2
- 向下移动一行(move statement down):alt+方向下键
- 向上移动一行(move statement up):alt+方向上键
- 向下开始新一行(start new line):Shift+enter
- 向上开始新一行(start new line before current):ctr+alt+enter
- 查看源码(class):ctrl+左单击和ctrl+Shift+T
- 万能解错/生成变量返回值:alt+enter == eclipse:ctrl+1
- 返回前一个编辑页面(back):alt+left
- 返回后一个编辑页面(forward):alt+right
- 查看继承结构(type hierarchy):F4
- 格式化代码(reformat code):ctrl+Shift+F
- 查看类结构:ctrl+O == eclipse:outline
- 大小写转换(toggle case):ctrl+Shift+y /ctrl+Shift+u
- 重构(rename):alt+Shift+r
- 生成构造器/get/set/toString:alt+MumPad 3
- 查看文档说明(quick documentation):F2
- 提示方法参数类型(parameter info): ctrl+alt+/
- 收起所有方法(collapse all): ctrl+Shift+MumPad /
- 打开所有方法(expand all) :ctrl+MumPad * ; 单个关闭ctrl+MumPad + 单个打开ctrl+MumPad -
- 打开代码所在硬盘文件(show in explorer):ctrl+Shift+x
- 生成try-catch等(surround with):alt++Shift+Z
- 局部变量抽取位成员变量(introduce field):
- 查找/替换当前:ctrl +f
- 查找(全局):ctrl+h
- 查找文件:double Shift
- 查看类继承结构图(show UML Diagram):ctrl+alt+Shift+U
- 查看方法的多层重写结构(method hierarchy):ctrl+Shift+H
- 添加到收藏(add to favorites):alt+Shift+L
- 抽取方法(extract method):alt+Shift+M
- 打开最近修改的文件(Recetly Files) Ctrl+E
- System.out.println(“”): sout+Tab
- 关闭当前打开的代码栏(close) Ctrl+F4
- 关闭打开所有的代码栏(close all):ctrl+Shift+W
- 快速搜索类中的错误(next highlighted error):ctrl+Shift+Q
- 选择要粘贴的内容(show in explorer):ctrl+Shift+v
- 查找方法在哪里调用(call Hierarchy):ctrl+alt+h
- 于定位到某一行:ctrl + L
- 重启Idea:ctrl+MumPad 5
- 鼠标焦点前进后还原位置:back ALT+< forward ALT+>
- CLASSPATH:%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar