Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to automatically generate class comments and method comments by idea

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how idea automatically generate class comments and method comments, I believe that most people do not understand, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Change the computer and reinstall idea, record the method of adding automatic comments, in case you use idea version: 2018.3.1

1. Generate class comments

Open setting-> Editor-> File and Code Templates-> Files-> Class

Generate a class annotation template

/ * * @ program: ${PROJECT_NAME} * @ description: ${description} * @ author ${USER} * @ date ${YEAR}-${MONTH}-${DAY} ${HOUR}: ${MINUTE}: ${SECOND} * /

Effect.

two。 Generate method comments

Open setting-> Editor-> Live Templates-> Click the plus sign on the right to add a Templates Group-> then select the added Group and click the plus sign again to add Live Templates

The added group name can be decided by yourself, but the added live templates name is best *

Generate a class annotation template

* * $VAR1 $$params$ * @ return $returns$ * @ author $user$ * @ describe: * @ date$ date$ $time$ * /

Then click Edit variables to configure variables

The script for VAR1 is as follows:

GroovyScript ("def result=''; def params=\" ${1}\ ".replaceAll ('[\ [|\] |\]]','). Split (','). ToList (); for (I = 0; I < params.size (); replaceAll) {if (iTune0) result+='*' Result+='@param'+ params [I] + ((I < (params.size ()-1))?'\ n' +'\ t':');}; return result ", methodParameters ())

Next, click define to check the desired file format. You can select all or only java.

At this point, the configuration has been completed, enter / * *, and then Tab

The above is all the content of the article "how idea automatically generates class comments and method comments". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report