How to set a custom note
The neat code and comment style always give people a bright and pleasing feeling. At the same time, detailed comments are also one of the professional qualities that programmers must have.
Today I will mainly share how to set custom comments in VS Code.
first step:
Use ctrl + shift + p to call up the following window, and enter snippets
Step 2: Enter json file editing
Here is an example of custom js annotations:
After entering the json file, add the following code, you can customize the design, save and exit. Here is a class comment and a method comment
"Print to js class": {
"prefix": "zhushiclass",
"body": [
"/*",
" *@Description: $0",
" *@ClassAuthor: Tian Qin",
" *@Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
"*/"
],
},
"Print to js method": {
"prefix": "zhushimethod",
"body": [
"/*",
" *@Description: $0",
" *@MethodAuthor: HeLihui",
" *@Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
"*/"
],
},
third step:
After saving and exiting, we can see the smart prompt in the js file.
After clicking, the comment will be automatically generated, and the date will be automatically generated.
Note that the html comment here is slightly different
because the html comment format is <--! -->
"Print to html method": {
"prefix": "zhushihtml",
"body": [
"<!-- ",
"**@Description: $0",
"-->"
],
},
Finally, I want to share the format of the red alert source code comments. After the red alert source code is released, his comments can be regarded as classics.
I have sorted out this comment and paid tribute to the classics!
"Print to js api": {
"prefix": "hongsejingjie",
"body": [
"/***************************************************************************************************",
" * AircraftClass :: $0 *",
" * @Description: $0 *",
" * @Description: $0 *",
" * @Description: $0 *",
" * *",
" * INPUT:$0 *",
" * *",
" * OUTPUT:$0 *",
" * *",
" * WARNINGS:$0 *",
" * HISTORY: *",
" * @MethodAuthor: HeLihui *",
" * @Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR} *",
"*==================================================================================================*/"
],
},
Since this was sorted out by myself, the effect is not very good, so please forgive me, and I hope you can continue to improve