日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

intellij注释模板_IntelliJ中的实时模板

發(fā)布時(shí)間:2023/12/3 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 intellij注释模板_IntelliJ中的实时模板 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

intellij注釋模板

如上所述這里 ,的IntelliJ的現(xiàn)場(chǎng)模板可以讓你輕松地插入預(yù)定義的代碼片段到你的源代碼。

我在下面發(fā)布了一些我最常用的模板,鏈接到我在GitHub上的模板文件的完整列表(作為設(shè)置新IntelliJ環(huán)境時(shí)的參考),以及將IntelliJ設(shè)置文件添加到GitHub所采取的步驟。

例如,我設(shè)置了一個(gè)模板,以便可以鍵入test并單擊tab,它將為我插入以下JUnit代碼片段:

@Test public void $NAME$() {$END$ }

這是一種JUnit測(cè)試方法,最初將光標(biāo)放在“ public void”之后,可以鍵入測(cè)試名稱(chēng)。 然后,光標(biāo)跳到{}之間,準(zhǔn)備開(kāi)始編寫(xiě)測(cè)試。

IntelliJ模板存儲(chǔ)在以下位置的user.xml文件中:

~/Library/Preferences/<product name><version number>/templates

例如,對(duì)于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上通過(guò)https://github.com/sabram/IntelliJ設(shè)置了一個(gè)新倉(cāng)庫(kù)。
然后,我遵循了這個(gè)StackOverflow帖子中有關(guān)如何將現(xiàn)有非空目錄轉(zhuǎn)換為Git工作目錄的說(shuō)明 :

cd ~/Library/Preferences/IntelliJIdea13 git init git add templates/user.xml git commit -m 'initial version of IntelliJ user.xml' git remote add myIntelliJRepo https://github.com/sabram/IntelliJ.git

在這一點(diǎn)上,我遇到一個(gè)錯(cuò)誤,提示我需要先進(jìn)行g(shù)it pull。 但是當(dāng)我做一個(gè)

git pull saIntelliJ

我說(shuō)錯(cuò)了

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)容對(duì).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,而無(wú)需每次都指定存儲(chǔ)庫(kù)名稱(chēng)(saIntelliJ)。

翻譯自: https://www.javacodegeeks.com/2014/04/live-templates-in-intellij.html

intellij注釋模板

總結(jié)

以上是生活随笔為你收集整理的intellij注释模板_IntelliJ中的实时模板的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。