# IntelliJ Idea

### 中文化

<https://github.com/IntelliJ-Localization/ij_resources_cn>

#### 教學手冊

<https://www.jetbrains.com/help/idea/install-and-set-up-product.html>

#### JAVA 11 DOC

<https://docs.oracle.com/en/java/javase/11/docs/api/index.html>

## Postfix Completions

參考資料:(<https://stackoverflow.com/questions/29248188/is-there-a-way-to-create-custom-postfix-completions-in-intellij>)

`$END$` 光標停的位置

`$EXPR$` 該物件放的位置

例如:我想要印出一個 Map `Map<String,String> map`

```
for(String key : map.keySet()){
    System.out.println("key + \"\" + params.get(key) = " + key + "" + map.get(key));
}
```

我只要設定 這個 Postfix Completions 的關鍵字為 `soutfor`

```
for(String key : $EXPR$.keySet()){
    System.out.println("key + \"\" + params.get(key) = " + key + "" + $EXPR$.get(key));
}
```

然後打

`map.soutfor`

就可以產生上面那段了

## Live Templates

可以利用此功能，去定義習慣的快捷鍵

Abbreviation : 設定這個模板的快捷鍵\
Description : 你對這個模板的描述\
Template text : 這個模板的內容 (請參考下面的內容)\
1\. 的地方要選擇你的語言，以我這邊為例，就是點進去，把 "Java" 勾起來\
2\. 可以對一些參數進行預設 (下圖2)

![圖1](/files/-Lz6JJmeETjr-9Fj-pBv)

Template text

```
/**
 * $END$
 * @param $params$
 * @return $returns$
 * @author Brian
 * @date $date$ $time$
 */ 
```

![圖2](/files/-Lz6JV1fXpNLGnHoqzOt)

這樣我只要打 `***` + tab 就可以產生下面結果

&#x20;

```
/**
 * 
 * @param 
 * @return 
 * @author Brian
 * @date 2020/01/21 17:05:03
 */ 
```

## File and Code Templates

到 Includes / Files Header 的內容 輸入下面的文字

```
/**
@author ${USER}
@date ${DATE} ${TIME}
*/
```

就可以在以後產生 class 檔的時候，直接附上創建者 & 創建時間


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brianwu.gitbook.io/brian/brians-za-ji/intellij-idea.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
