Use Code | Reformat Code to reformat code according to your code style preferences (File | Settings | Code Style).
You can also use Code | Optimize Imports to automatically optimize imports (remove unused imports, etc.).
To access the corresponding settings, use File | Settings | Code Style | Imports.
根据你的代码样式偏好(可在 File | Settings | Code Style 下设置)使用Code下的Reformat Code(快捷键:Ctrl+Alt+L)来格式化代码。
备注:File | Settings 的快捷键:Ctrl+Alt+S
你也可以使用 Code | Optimize Imports (快捷键:Ctrl+Alt+O)来自动导包(移除没有引用的包,等等),
对应的设置在 File | Setting | Code Style | Imports 中。
备注:在 File | Setting | Code Style 下没有找到 Imports ,但在File | Setting | Code Folding 下找到了 Imports,如下图
To see your local history of changes in a file, invoke Local History | Show History from the context menu.
You can navigate through different file versions, see the differences and roll back to any previous version.
Use the same context menu item to see the history of changes on a directory. You will never lose any code with this feature!
你可以通过在当前代码中右键选择 Local History | Show History 来查看当前文件的各个不同的保存版本
(每次保存都会在History中存储一个副本,有点类似git或者svn)。
Press Alt+Q (View | Context Info) to see the declaration of the current method without the need to scroll to it.
快捷键Alt+Q (或者通过: View | Context Info)来查看当前方法的声明信息,而不用滑动去查找
(即:包含当前光标所在位置的不可见的第一层方法声明。有点绕,感觉使用的不多=。=)。
Ctrl+E (View | Recent Files) brings a popup list of the recently visited files. Choose the desired file and press Enter to open it.
Besides recent files, you can bring up results of the usage searches you have performed recently. To do that,
use the same Ctrl+E shortcut with the Find tool window having the focus, and select the desired find usages result from the Recent Find Usages popup.
使用Ctrl+E (View | Recent Files)来查看最近访问过的文件,另外,你也可以在光标在Find上时使用Ctrl+E来查看最近Find用过的情况。
Use F2/Shift+F2 keys to jump between highlighted syntax errors.
Use Ctrl+Alt+向上箭头/Ctrl+Alt+向下箭头 shortcuts to jump between compiler error messages or search operation results.
To skip warnings right click on the validation side bar / marker bar and choose Go to high priority problems only.
使用F2(自上而下)/Shift+F2(自下而上)在高亮的错误语法间跳动;
使用Ctrl+Alt+向上箭头/Ctrl+Alt+向下箭头 在错误的编译信息或者查找操作历史中跳动;
为了跳过警告信息,你可以在validation side bar 或 marker bar上右击,然后选择优先级更高的问题;
Use Ctrl+J to complete any valid Live Template abbreviation if you don't remember it.
For example, type it and press Ctrl+J to see what happens.
使用Ctrl + J来进行模版的调用,类似eclipse中输入syso后按Alt + / 。
To show separator lines between methods in the editor, open the editor settings
and select the Show method separators check box in the Appearance page.
为了在两个方法间添加分割线,你可以打开编辑器设置,在Appearence 中选择Show method separators 选项。
When using basic code completion (Ctrl+空格), type any characters that exist anywhere in an identifier.
输入部分关键字可以利用“Ctrl+空格”进行代码补全,类似Git中使用Tab键。备注:经测试发现“Ctrl+空格”不起作用,更改快捷键后可以正常使用。
Use Alt+向上箭头 and Alt+向下箭头 keys to quickly move between methods in the editor.
使用Alt+向上箭头 和 Alt+向下箭头可以使光标在相邻的方法间跳动。
Ctrl+Shift+J shortcut joins two lines into one and removes unnecessary space to match your code style.
使用Ctrl+Shift+J可以将选中的多行代码合并为一行,并且自动移除无用的空格。
Use Refactor | Copy to create a class which is a copy of the selected class. This can be useful, for example,
when you need to create a class which has much in common with some existing class
and it's not feasible to put the shared functionality in a common superclass.
使用Refactor | Copy(快捷键: F5)可以复制一份当前选择的类,当然你也可以通过Ctrl + C ,Ctrl + V 来实现相同的效果。
Use the Ctrl+Shift+V shortcut to choose and insert recent clipboard contents into the text.
使用 Ctrl+Shift+V 可以选择最近保存在剪切板上的内容,Ctrl+V的增强模式。
To see the inheritance hierarchy for a selected class, press Ctrl+H (Navigate | Type Hierarchy).
You can also invoke the hierarchy view right from the editor to see the hierarchy
for the currently edited class.
利用Ctrl+H (Navigate | Type Hierarchy)可以查看当前所选类的继承层级,你也可以点击编辑器的右边的 hierarchy来实现相同的效果。
Right-clicking on a breakpoint marker (on the bar to the left from the text) invokes the speedmenu
where you can quickly enable/disable the breakpoint or adjust its properties.
在断点上右击鼠标,你将能够快速地对该断点调整。
To easily evaluate the value of any expression while debugging the program,
select its text in the editor (you may press a Ctrl+W a few times to efficiently perform this operation)
and press Alt+F8.
当debug程序时,你可以用通过Ctrl+W选中表达式,然后按下Alt+F8来快速验证表达式的值。
To quickly evaluate the value of any expression while debugging the program,
hold Alt and click this expression to see its value and calculate it, call a method, etc.
当debug程序时,你可以通过按住Alt的同时点击表达式来查看表达式的值。
Use Basic Completion (Ctrl+空格) for completing words in text and comments in files of many different types.
All the words from the current file that start with the typed prefix will appear in the lookup list.
同8.2016-03-24
The shortcuts such as Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration)
and others can be used not only in the editor but in the code completion popup list as well.
快捷键Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration) 等,
不仅可以在编辑器中使用,还可以在弹框中使用。
When using Code Completion, you can accept the currently highlighted selection in the popup list
with the period character (.), comma (,), semicolon (;), space and other characters.
The selected name is automatically entered in the editor followed by the entered character.
当使用代码自动不全的时候,你可以通过Enter键自动输入弹框中高亮的被选择的内容。
To help you learn the purpose of each item in the main menu, its short description is shown
in the status bar at the bottom of the application frame
when you position the mouse pointer over this item.
搜索时*通配符的使用