idea-notes
IDEA使用笔记
IntelliJ IDEA Help Documentation
Plugins
Background Image Plus
CodeGlance: vscode右侧代码地图
Translation
Rainbow Brackets: 彩虹色括号
Grep Console: 日志着色控制台显示
Statistic: 代码统计
Markdown Navigator
RestfulToolkit: 快速定位controller层接口、接口测试
GsonFormat: Json转Java类
Mybatis Log Plugin: 快速打印SQL语句
Free Mybatis Plugin: mybatis xml id与接口间跳转
Material Theme UI: 美化
Lombok: 省掉手动set/get方法
Alibaba Java Coding Guidelines: 阿里巴巴开发规范
Easy Code: 数据库表生成JavaBean
JRebel for IntelliJ: JavaWeb项目热部署
Key Promoter X: 快捷键提示
.ignore: 生成git ignore文件
SonarLint 帮助你扫描代码的问题,例如 性能,安全和重复问题。新手必备!显著提升代码质量!
maven helpler 更好的进行依赖管理
mybatis pro 付费,但是可以有其他办法用[doge]
color themes 有各种好看的主题,推荐sublime 3主题
ANSI Highlighter 在IntelliJ编辑器下渲染ANSI转义序列
SequencePlugin 显示指定方法的序列图
javadoc 生成/删除/更新 javadoc
Shortcut
- Window Setting
ctrl + shift + F12: 隐藏所有窗口,除了编辑器shift + F12: 恢复默认窗口布局alt + 1: 将焦点移至project窗口,在焦点已经在project窗口时,trigger该窗口ctrl + e: 最近打开的文件
- Editor
ctrl + shift + j: 将光标处下一行的内容合并至当前行的行尾ctrl + shift + up/down: 上移/下移语句或方法alt + insert: Generate 自动创建方法或文件解决错误等功能alt + <CR>: Show Context Actionctrl + <LEFT ARROR>: Expand Current Windowctrl + <RIGHT ARROR>: Shrink Current Windowctrl + shift + delete: Unwrap/Removectrl + alt + v: Introduce Local Variablectrl + alt + q: Toggle Reader Modectrl + F12: Open File Structure Popup Window

- Surround Code & Live Template
ctrl + alt + t: Surround with Suggest Code Block and Live Template
ctrl + alt + j: Surround with Live Templatectrl + j: Insert Live Template
- Reformat Code
ctrl + alt + o: Optimize Importsctrl + alt + l: Reformat the whole file or Selected Filectrl + alt + shift + l: Show Reformat Dialog
- Run/Debug
shift + F10: Run current selected configurationctrl + shift + F10: Run the executable method where the cursor is located, such as a unit test or the main method, etc.shift + F9: Debug current selected configurationF9: Open the debug dialog
- VCS
alt + \``: Open VCS Operations meunctrl + alt + a: Add current file to VCSctrl + k: Open the commit interfacectrl + shift + k: Open push interfacealt + 9`: Toggle Git tool window
Shortcut for Plugin
- String Manipulation
alt + m: Open opreation meun
- Code Glance
ctrl + shift + g: toggle glance
- TranslationPlugin
ctrl + shift + y: translate seleted text
Default Live Template
.var: 声明一个变量 <=> ctrl +alt + v (variable).if: 将前面的对象用 if 进行包裹iter: 遍历最近的可遍历对象(for-each)sout: System.out.println()soutv: System.out.println(variableName = variableValue)main/psvm: public static void main(String[] args) {}
Live Template Variables
- $END$
The cursor position when all parameters are filled.$END$indicates the position of the cursor when the code snippet is complete, and you can no longer press Tab to jump to the next variable. - $SELECTION$
$SELECTION$is used in surround templates and denotes the code fragment to be wrapped. After the template expands, it wraps the selected text as specified in the template. For example, if you select EXAMPLE in your code and invoke the “$SELECTION$“ template via the assigned abbreviation or by pressingCtrl+Alt+Tand selecting the desired template from the list, IntelliJ IDEA will wrap the selection in double quotes as follows: “EXAMPLE”.
Reformat & Rearrange
Reformat & Rearrange Offical Documentation
- Code cleanup
Select this option to run the code cleanup inspections. IntelliJ IDEA finds and automatically fixes potentially problematic code fragments.
Run Commands using IDE
- IDEA 2020 new feature

- Run Commands using IDE Press
Ctrl+Enterto run the highlighted action using the relevant IDE feature instead of the terminal. PressCtrl+Shift+Enterfor debug. PressEnterto run the command in the terminal as usual. You can turn this behavior on/off in Settings | Tools | Terminal.
Version Control
Commit
- use non-modal commit interface (IDEA 2020 new feature)

Changelist
A changelist is a set of local changes that have not yet been committed to a VCS repository.
With changelists, you can group changes related to different tasks and commit these sets of changes independently.
Debugger
IDEA - Debugger 经验总结
IntelliJ IDEA Debugger 经验总结 - youtube
Analyze external stack traces
You might want to analyze exceptions received by someone else, for example, QA engineers, or investigate a deadlock, or a hang-problem. Unlike the exceptions that you get in the debug mode or when running unit tests, these exceptions do not have links that help you navigate to the corresponding locations in the source code. Moreover, the source code can be scrambled.
With IntelliJ IDEA, you can copy an exception or full thread dump, paste it to the Stack Trace Analyzer, explore information, and navigate to the corresponding source code.
Alter the program’s execution flow
Alter the program’s execution flow
While debugging an application, you typically follow the normal flow of a program. However, there are cases when you need to deviate from it. This can be required in order to reproduce certain conditions or to test how the program deals with issues (for example, processes a null value or handles an exception).
Return to a previous stack frame
IntelliJ IDEA lets you fall back to a previous stack frame in a program’s execution flow. This can be useful, for example, if you’ve mistakenly stepped too far, or want to re-enter a method where you missed a critical spot.
- Click the Drop Frame icon Drop frame on the toolbar of the Debug tool window.

Force return from the current method
You can exit a method before it reaches the return statement and make it return an arbitrary value. This is useful when the problem is related to the return value of the method and not to how it’s produced. Force return helps you test how the return values are handled by the program without having to reproduce the conditions that lead to these values.
Throw an exception
Reload modified classes
Analyze Java Stream operations
Analyze Java Stream operations
Java 8 Streams may sometimes be difficult to debug. This happens because they require you to insert additional breakpoints and thoroughly analyze each transformation inside the stream. IntelliJ IDEA provides a solution to this by letting you visualize what is going on in Java Stream operations.
Plugins Descriptions
javadoc
Plugin generates java docs for all elements in java classes.
To generate javadocs for active element press “shift + alt + G”.
To generate javadocs for all elements in current java file press “shift + ctrl + alt + G”.
You can also select a part of code in editor and press “shift + alt + G” or from context dialog (“Javadocs -> Selected element” in case of Intellij Idea before 13 and “JavaDocs for the selected element” in case of Intellij Idea 13 and greater) and javadocs will be created for all selected elements.
Both of this actions could be executed from the generate popup dialog (“alt + insert”).
Since release 1.0.11 new shortcuts are available:
- Remove javadocs on current/selected element: “shift + alt + Z”
- Remove javadocs on all elements of current class: “shift + ctrl + alt + Z”
- From project view available new option to Create javadocs for selected folder/files
- From project view available new option to Remove javadocs for selected folder/files