Skip to main content

Postfix Completion

CodePerfect supports a number of postfix completions. Postfix completions are basically a type of macro that you trigger as if they were methods on whatever you're typing:

For instance, if you type foo., it will show you postfix completions such as ifnotnil!. If you select that, it replaces foo. with

if foo != nil {


and places your cursor where the grey block is. (It doesn't add an actual block character, it's there in the example to mark where the cursor moves.)

Postfix completions provide shortcuts that operate on some expression, to complete certain idioms or phrases. For instance, x.append! becomes append(x, █), and x.aappend! (for "assign append") becomes x = append(x, █).


To use a postfix completion, you have to type x. and then actually select append! from the menu. Nothing will happen if you just type out x.append! manually.

Supported Completions

The examples all assume the completion is operating on an expression foo, e.g. foo.append!.

.aappend!foo = append(foo, █)
.append!append(foo, █)
for key, val := range foo {

for key := range foo {

for _, val := range foo {

.nil!foo == nil█
.notnil!foo != nil█
.empty!foo == nil || len(foo) == 0█
if foo == nil || len(foo) == 0 {

if foo {

if !foo {

if foo == nil {

if foo != nil {

val, err := foo
if err != nil {

type foo struct {

type foo interface {

switch foo {