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支持對(duì) Java?, JSP, XML, HTML等文件的語(yǔ)法突出編輯,即使是自定義的文件,也可以通過代碼編輯器來使得其可以被識(shí)別和語(yǔ)法突出化)
Advanced Code Completion(先進(jìn)的代碼完成功能)
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代碼完成 可以完成對(duì)類、方法、變量名和Java關(guān)鍵字的識(shí)別,根據(jù)不同的類型,可以從自動(dòng)彈出的列表框中選擇已有的方法和域 名)
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代碼完成,會(huì)根據(jù)目前的表達(dá)式的類型來對(duì)彈出列表框中的方法和變量進(jìn)行類型匹配,彈出框中右邊的就是那些方法變量等的返回類型,IDEA還會(huì)羅列出其他你可能用到的類型)
The Class Name code completion finishes a class name anywhere in the project or libraries independently of imports in the current file.
(Class Name 代碼完成可以在任何工程、庫(kù)以及當(dāng)前獨(dú)立的文件中幫你完成類名字的書寫)
Closing brace auto-insert(復(fù)合語(yǔ)句的自動(dòng)插入(前后括號(hào)自動(dòng)匹配))
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.
(當(dāng)你鍵入“{”來開始一組復(fù)合語(yǔ)句時(shí),“}”會(huì)自動(dòng)插入進(jìn)行匹配,插入的方式也可以由你來訂制)
Matched brace highlighting(匹配括號(hào)的突出顯示)
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).
(當(dāng)光標(biāo)移動(dòng)至括號(hào)時(shí),不管是左括號(hào)還是右括號(hào),如果它可以正確匹配,他將會(huì)以淺藍(lán)色突出顯示,如果沒有與之相匹配的括號(hào),則將會(huì)有錯(cuò)誤提示,當(dāng)然,突出的顏色也可以設(shè)置)
Pasted text auto-indent(粘貼代碼自動(dòng)縮進(jìn))
Paste a block of text into your code and IDEA automatically indents it to fit the new location.
(當(dāng)粘貼一段代碼到IDEA代碼編輯中時(shí),他會(huì)自動(dòng)縮進(jìn)到合適的位置)
Live Templates(動(dòng)態(tài)模板)
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.
(動(dòng)態(tài)模板提供了一些典型代碼的快速輸入,只需要輸入動(dòng)態(tài)模板的名字,按TAB,不論是簡(jiǎn)單的還是復(fù)雜的代碼都會(huì)立刻完成。動(dòng)態(tài)模板還會(huì)自動(dòng)分析現(xiàn)有代碼,插入合適的變量名,動(dòng)態(tài)模板的使用不僅在光標(biāo)位置,他還適用于被選中的文本代碼)
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.
(使用一個(gè)鍵就可以使選中的代碼進(jìn)行注釋或反注釋,注釋的插入位置可以設(shè)置)
Popup parameter info(參數(shù)彈出提示)
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.
(當(dāng)輸入一個(gè)新的方法時(shí),在輸入“(”后就會(huì)有這個(gè)方法參數(shù)的彈出提示,當(dāng)前參數(shù)將會(huì)以粗體顯示,你可以在Completion settings中控制是否彈出,和彈出延時(shí))
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語(yǔ)句進(jìn)行折疊,隱藏他們的細(xì)節(jié),只需點(diǎn)擊一下,就可以打開或合上他們)
Mouse over ?folded? code icons to pop up the hidden detail for quick examination.
(將鼠標(biāo)移至到合上的代碼時(shí),隱藏的內(nèi)容會(huì)暫時(shí)顯示出來)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.
(通過分割欄,可以將代碼分成兩部分獨(dú)立工作,拖動(dòng)分割欄可以調(diào)整大?。?/p>
Clipboard stacking(超級(jí)剪貼版)
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.
(擁有可以儲(chǔ)存多次剪貼內(nèi)容的剪貼版,記錄的剪貼內(nèi)容數(shù)也可以設(shè)置)