Hot Posts

IntelliJ Live Template

IntelliJ IDEA’s Live Templates are snippets of code that auto-complete at a touch of a key combination increasing your productivity.

IntelliJ IDEA IntelliJ IDEA

Intellij IDEA is the best IDE I have ever used and one reason this is true is live templates.

Live templates are snippets of code that auto-complete at a touch of a key combination saving you valuable figure energy.

And this is how you create Live Template of your own.

Let’s create a live template that surrounds a variable with Objects.requireNonNull().

  1. Press CTRL + ALT + S to display the Settings dialogue box
  2. Click the + button and select Live Template
  3. Enter and abbreviation. Let’s enter orn
  4. Enter a description. Let’s enter Objects.requireNonNull(…)
  5. Enter the template text. Let’s enter
    java.util.Objects.requireNonNull($SELECTION$)$END$
  6. Ticket Shorten FQ names
  7. Click the Define link and select Java
  8. Let’s use it. Highlight a variable and press CRTL + ATL + J and select the live template we just created.
  9. That’s it.

Go make more live templates. Be careful it’s addictive.

Link to IntelliJ Live Template help.

About Alex (67 Articles)
Enterprise Developer. Passionate about the Java EE eco-system, Java 8 and microservices. Author, trainer, conference speaker and blogger. Oracle certified.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: