Skip to content

Latest commit

 

History

History
134 lines (89 loc) · 2.26 KB

README.md

File metadata and controls

134 lines (89 loc) · 2.26 KB

My IntelliJ Templates

This is a collection of IntelliJ Live Templates and templates for the Custom Postfix Templates Plugin.

Live Templates

To use one of the Live Templates, copy the XML content into your clipboard, then paste (Ctrl-V / Cmd-V) it into the IntelliJ Live Templates settings dialog:

paste.png

ast AssertJ assertThat...

Expands to:

assertThat(<expression>)
        .<is>(<end>);

ase AssertJ assertThat.isEqualTo

Expands to:

assertThat(<expression>)
        .isEqualTo(<end>);

asc AssertJ assertThat.containsExactly

Expands to:

assertThat(<expression>)
        .containsExactly(<end>);

tni Throw Not Implemented

Expands to:

throw new UnsupportedOperationException("$METHOD_NAME$ is not implemented.");

Custom Postfix Templates

java-general contains a few postfix template I like to use:

.ast AssertJ assertThat...

"applesauce".ast

Expands to:

assertThat("applesauce")
        .<end>;

.ase AssertJ assertThat.isEqualTo

"applesauce".ase

Expands to:

assertThat("applesauce")
        .isEqualTo(<end>);

.asc AssertJ assertThat.containsExactly

List<String> fruit = List.of("Apple", "Banana");
fruit.asc

Expands to:

List<String> fruit = List.of("Apple", "Banana");
assertThat(fruit)
        .containsExactly(<end>);

.toMap Map Stream Collector

List<String> fruit = List.of("Apple", "Banana");
fruit.toMap

Expands to:

List<String> fruit = List.of("Apple", "Banana");
fruit.stream().collect(toMap(
  e -> <key>,
  e -> <value>
));

.lof Wrap Expression in List.of()

"Carrot".lof

Expands to:

List.of("Carrot")

Ted Young's Postfix Templates

In addition to these I also import Ted's Postfix Templates for the .nv New Variable template.

Game.nv

Expands to:

Game <end> = new Game();