Intellij IDEA 4 新特性 之 Code Editing (代码编辑)
扫描二维码
随时随地手机看文章
IDEA supports the editing of Java™, JSP, XML, HTML files, as well as custom file types that can be easily defined to be recognized and properly highlighted by the editor.
(IDEA支持对 Java™, JSP, XML, HTML等文件的语法突出编辑,即使是自定义的文件,也可以通过代码编辑器来使得其可以被识别和语法突出化)
Advanced Code Completion(先进的代码完成功能)
Basic code completion finalizes a class, method, variable name, and Java keywords, plus commonly used names for fields and variables depending on their type. It can be automatically invoked, popping up the available methods and fields list.
(Basic代码完成 可以完成对类、方法、变量名和Java关键字的识别,根据不同的类型,可以从自动弹出的列表框中选择已有的方法和域 名)
The SmartType code completion filters the method and variable list to match the expected expression type. It works at the right-hand side of assignments, in variable initializers, return statements and anywhere else where IDEA can guess the expected type.
(SmartType代码完成,会根据目前的表达式的类型来对弹出列表框中的方法和变量进行类型匹配,弹出框中右边的就是那些方法变量等的返回类型,IDEA还会罗列出其他你可能用到的类型)
The Class Name code completion finishes a class name anywhere in the project or libraries independently of imports in the current file.
(Class Name 代码完成可以在任何工程、库以及当前独立的文件中帮你完成类名字的书写)
Closing brace auto-insert(复合语句的自动插入(前后括号自动匹配))
Start a code block with an opening curly brace character and press Enter.
The corresponding closing brace is automatically inserted with the indentation specified in your preferences.
(当你键入“{”来开始一组复合语句时,“}”会自动插入进行匹配,插入的方式也可以由你来订制)
Matched brace highlighting(匹配括号的突出显示)
Place the Editor caret just after a closing (or just before an opening) brace or bracket of any type. If it is correctly matched, the matching pair highlights with light blue. If there is no matching bracket, the unpaired bracket highlights as a compile error. (You can change the default highlight colors in your configuration).
(当光标移动至括号时,不管是左括号还是右括号,如果它可以正确匹配,他将会以浅蓝色突出显示,如果没有与之相匹配的括号,则将会有错误提示,当然,突出的颜色也可以设置)
Pasted text auto-indent(粘贴代码自动缩进)
Paste a block of text into your code and IDEA automatically indents it to fit the new location.
(当粘贴一段代码到IDEA代码编辑中时,他会自动缩进到合适的位置)
Live Templates(动态模板)
Live Templates provide a fast way to code many typical constructs. Just type the Live Template name, press Tab, and the relevant code... simple or highly complex... is written to your file instantly. When you insert code from a Live Template, IDEA analyzes your existing code and suggests correct values for the template’s variables. Now you can apply Live Templates not only at a particular caret position, but for selected blocks of code/text as well.
(动态模板提供了一些典型代码的快速输入,只需要输入动态模板的名字,按TAB,不论是简单的还是复杂的代码都会立刻完成。动态模板还会自动分析现有代码,插入合适的变量名,动态模板的使用不仅在光标位置,他还适用于被选中的文本代码)
Express code commenting(快速代码注释)
Use a single keystroke to quickly comment/uncomment a selected line or block with either block (/*…*/) or line (//…) comments. Comments insert at the first column, or at the indentation level, depending on your preferences.
(使用一个键就可以使选中的代码进行注释或反注释,注释的插入位置可以设置)
Popup parameter info(参数弹出提示)
When coding a new method call, a tooltip showing the target method’s signature pops up after you type the opening “(” character or invoke code completion features. The parameter highlighted in bold is the one on which the caret is currently positioned. You can control the popup interval or disable the popup completely in Completion settings.
(当输入一个新的方法时,在输入“(”后就会有这个方法参数的弹出提示,当前参数将会以粗体显示,你可以在Completion settings中控制是否弹出,和弹出延时)
Code folding(代码折叠)
Easily “fold” and “unfold” methods, Javadoc comments, or blocks of import statements, putting distracting detail out of your way. Fold/unfold a single block or everything in the file at once with a single keystroke.
(你可以将JavaDoc注释、方法体、或者一系列的import语句进行折叠,隐藏他们的细节,只需点击一下,就可以打开或合上他们)
Mouse over «folded» code icons to pop up the hidden detail for quick examination.
(将鼠标移至到合上的代码时,隐藏的内容会暂时显示出来)Split-pane editor(双块代码编辑)
Split the Editor into two half panes to work in two different places in the same file simultaneously. Move the pane splitters to adjust the size of the panes.
(通过分割栏,可以将代码分成两部分独立工作,拖动分割栏可以调整大小)
Clipboard stacking(超级剪贴版)
Now store multiple clipboard entries and access them with a single shortcut. Customize the number of entries that can be stored in the clipboard stack.
(拥有可以储存多次剪贴内容的剪贴版,记录的剪贴内容数也可以设置)