Skip to content

IntelliJ Live Templates and Custom Postfix Templates

License

Notifications You must be signed in to change notification settings

Suigi/intellij-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

IntelliJ Live Templates and Custom Postfix Templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published