IntelliJ postfix completions

Craig Motlin
Jan 18, 2019

--

IntelliJ’s postfix completions were announced in 2014 but remain relatively unknown. Postfix code completion helps reduce backward caret jumps as you write code. You use it as if you’re auto-completing a method name, but with the name of a postfix template.

Here are a few postfix completions I’ve added for Java. They are available for download here.

Rethrow checked exception as runtime exception

Before: $EXPR$.rethrow

After: throw new RuntimeException($EXPR$);

Applicable type: java.lang.Exception

Adapt a collection with Eclipse Collections

Before: $EXPR$.adapt

After: org.eclipse.collections.impl.list.mutable.ListAdapter.adapt($EXPR$)

Applicable type: java.util.List

In addition to ListAdapter, I have equivalent rules for SetAdapter, MapAdapter, and ArrayAdapter. Since each applies to a specific type, it’s not a problem for all 4 to share the same key “adapt”.

This was originally posted at https://motlin.com/intellij/2022-11-06-intellij-postfix-completions/

--

--