IntelliJ IDEA: code snippet auto-complete

In this tutorial I will show how to create auto-complete snippets using IntelliJ IDEA. This is a very convenient for such things as copyright information that I need to include in clients' files.



Step: Create snippet

Open Preferences > "Live Templates" > Click "+" > Create "Java > copyright" as shown in the screenshot
Abbreviation will be the keyword you will use to trigger the completion.



Step: Set what it is applicable to

Mark it for Java and XML (or any other files you may want to)


Step: Use the abbreviation



In your code start typing "copyright" and the auto-completion will suggest the right snippet.



/*
 * Copyright (C) 2014 CNH Industrial NV. All rights reserved.
 *
 * This software contains proprietary information of CNH Industrial NV. Neither
 * receipt nor possession thereof confers any right to reproduce, use, or
 * disclose in whole or in part any such information without written
 * authorization from CNH Industrial NV.
 *
 */
package com.cnh....


I hope this will save you some time!

It take time and effort to create tutorials, please support my efforts with a couple dollar donation, any amount will be greatly appreciated!



As an Amazon Associate I earn from qualifying purchases.

No comments:

Post a Comment

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

Popular Recent Posts

Most Popular Articles

apt quotation..