IntelliJ Live Template
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().
- Press CTRL + ALT + S to display the Settings dialogue box
- Click the + button and select Live Template
- Enter and abbreviation. Let’s enter orn
- Enter a description. Let’s enter Objects.requireNonNull(…)
- Enter the template text. Let’s enter
java.util.Objects.requireNonNull($SELECTION$)$END$
- Ticket Shorten FQ names
- Click the Define link and select Java
- Let’s use it. Highlight a variable and press CRTL + ATL + J and select the live template we just created.
- That’s it.
Go make more live templates. Be careful it’s addictive.
Link to IntelliJ Live Template help.
Leave a Reply