intellij注释模板_IntelliJ中的实时模板
intellij注釋模板
如上所述這里 ,的IntelliJ的現(xiàn)場模板可以讓你輕松地插入預(yù)定義的代碼片段到你的源代碼。
我在下面發(fā)布了一些我最常用的模板,鏈接到我在GitHub上的模板文件的完整列表(作為設(shè)置新IntelliJ環(huán)境時的參考),以及將IntelliJ設(shè)置文件添加到GitHub所采取的步驟。
例如,我設(shè)置了一個模板,以便可以鍵入test并單擊tab,它將為我插入以下JUnit代碼片段:
這是一種JUnit測試方法,最初將光標(biāo)放在“ public void”之后,可以鍵入測試名稱。 然后,光標(biāo)跳到{}之間,準(zhǔn)備開始編寫測試。
IntelliJ模板存儲在以下位置的user.xml文件中:
~/Library/Preferences/<product name><version number>/templates例如,對于IntelliJ13,它是
~/Library/Preferences/IntelliJIdea13/templates/user.xml 下面列出了我的其他一些模板,觸發(fā)器以粗體顯示。
為了可以在任何IntelliJ(例如工作和家庭)上使用這些模板,我在GitHub的此處檢查了完整的列表。
之前
@Before public void setup() {$END$ }后
@After public void tearDown() {$END$ }yi
fail("Not yet implemented");聚甲醛
public void $NAME$() {$END$ }主要
public static void main(String[] args){$END$ }我采取的將IntelliJ設(shè)置添加到GitHub的步驟
首先,我在GitHub上通過https://github.com/sabram/IntelliJ設(shè)置了一個新倉庫。
然后,我遵循了這個StackOverflow帖子中有關(guān)如何將現(xiàn)有非空目錄轉(zhuǎn)換為Git工作目錄的說明 :
在這一點(diǎn)上,我遇到一個錯誤,提示我需要先進(jìn)行g(shù)it pull。 但是當(dāng)我做一個
git pull saIntelliJ我說錯了
You asked to pull from the remote 'saIntelliJ', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line.因此,我根據(jù)此發(fā)布內(nèi)容對.git / config進(jìn)行了編輯,以包括
[branch "master"] remote = saIntelliJ merge = refs/heads/master然后我就可以
git pull saIntelliJ git push -u saIntelliJ master成功,并且可以繼續(xù)使用git pull和git push,而無需每次都指定存儲庫名稱(saIntelliJ)。
翻譯自: https://www.javacodegeeks.com/2014/04/live-templates-in-intellij.html
intellij注釋模板
總結(jié)
以上是生活随笔為你收集整理的intellij注释模板_IntelliJ中的实时模板的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 代沟是什么 什么是代沟
- 下一篇: 无浪费编码