天天看點

intellij idea優化_生成main方法_自動補全代碼_live template

用慣myeclipse,輸入main可自動生成main方法,輸入syso可自動生成列印語句,但是到idea發現就不行了。

idea的代碼補全分兩類:1是單詞補全,2是模闆替換

其中模闆替換可自定義:setting中的live template中

intellij idea優化_生成main方法_自動補全代碼_live template

1、新增檔案夾(template group):如:java

2、新增模闆(live template):如:main

3、填寫模闆内容

public static void main(String[] args){

}

4、增加變量:光标會定位到變量友善修改,也可為空,僅定位光标,可以給變量設定預設值

public static void main(String[] args){

    $start$

}

5、定義作用域:如整個java作用域

intellij idea優化_生成main方法_自動補全代碼_live template

6、定義觸發快捷鍵:如enter

确定後,回到java類中測試,輸入main,按ent鍵,main方法就生成了,且光标定位在start變量處

debug快捷鍵

9            resume programe 恢複程式

Alt+F10       show execution point 顯示執行斷點

F8            Step Over 相當于eclipse的f6      跳到下一步

F7            Step Into 相當于eclipse的f5就是  進入到代碼

Alt+shift+F7  Force Step Into 這個是強制進入代碼

Shift+F8      Step Out  相當于eclipse的f8跳到下一個斷點,也相當于eclipse的f7跳出函數

Atl+F9        Run To Cursor 運作到光标處

ctrl+shift+F9   debug運作java類

ctrl+shift+F10  正常運作java類

alt+F8          debug時選中檢視值