# 20. 特殊代码模板：Postfix Completion

## Postfix Completion 的介绍

Postfix Completion 功能本质上也是代码模板，只是它比 Live Templates 来得更加便捷一点点而已。具体它是做什么的，我们通过下面一张 Gif 演示图来说明：

![Postfix Completion 的介绍](/files/-M5dljeTW4JO8nStrNIf)

> * 如上图标注 1 所示，非空的判断在 Java 代码中应该是非常常见的一句话代码，如果用 Live Templates 当然也是可以快速生成，但是没有上图 Gif 这种 Postfix Completion 效果快。也许只是快了那么 0.01 秒，但是有如此好用的功能不用也是一种浪费。

## Postfix Completion 的设置

![Postfix Completion 的设置](/files/-M5dljeV_kiqgLsazthQ)

> * 如上图红圈所示，IntelliJ IDEA 只提供了是否启用的开关，其他的设置就没了。所以如果目前的版本中你还无法想对该功能进行自定义。IntelliJ IDEA 也对常用到的一些固定格式的代码进行了归纳，基本目前也够用了。


---

# 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://einverne.gitbook.io/intellij-idea-tutorial/postfix-completion-introduce.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.
