Intellj idea how to set class header comments and method annotations

Source: Internet
Author: User
Tags custom name

Intellj idea how to set the class header comments and method comments Intellj The power of thought is not much to say, believe that everyone who has used it will appreciate it, but we will also be confused by his complexity, especially the children's shoes just turned from eclipse, I believe that the first experience is not        Look back, I also step by step so come.        One of today's topics is how to implement a feature like Eclipse code templates that implements file-level annotation at the method level. A: File-level Comment file-level comments online has been a lot of introduction, this article does not long introduction, mainly through the file--"setting--" in the file and Code template to set two: method level comment File level comment There are already a lot of things on the web, but the method-level annotations are small and many people don't know how to do it. This method I share is also a personal skill in using the INTELLJ process, and if you have a better way, you can give more ideas in the comments.        The main thing is to do it through INTELLJ's powerful live template. The following is a brief introduction to Live template (the following excerpt from the network, click here to enter the original text-more detailed use of live template and advanced, please refer to the article at the bottom of the link):Using the Eclipse shortcut key people may not be accustomed to, Sysout, foreach and other shortcuts can not be found, the main method can not be automatically complete, in fact, this in IntelliJ has an exceptionally powerful module live template to achieve.

For example, if you try to psvm+tab in class, you will see that the main method is generated, and input iter+tab, and a foreach statement is generated.
The live template also has a surround usage, select a variable, type Ctl+alt+j two times, and an auto-complete menu appears.

In addition, you can customize the live Template. Code Snippet Technology application is also very common, IntelliJ Live template advantage is built-in some intelligent variables and functions, can do some semantic level analysis and application

   Here are the steps:1, click file--"setting--" Live Template, click on the right of the + sign, select Template Group 2, enter the MyGroup (you can also enter a different custom name), and then click OK. 3, select MyGroup, click on the right of the + number again, select Live Template 4, click the Fourth step define, select Everywhere 5, click on the right of the edit variables 6, click Ok,apply , quit, done. Enter the CMT anywhere on the page and click Enter to experience it. My above this little trick is just a personal in the use of Intellj a little trick, Live template use, you can refer to the following links, suggest that you read carefully, to their common code is very helpful. IntelliJ using code/live template to speed up encoding: The programmer's job is not to write programs, but to write programs to solve problems IntelliJ live template advanced using a list of predefined functions in INTELLJ Live template

Link Address: http://blog.sina.com.cn/s/blog_4c4195e70102wh7e.html

Intellj idea how to set class header comments and method annotations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.