当前位置:网站首页>Vscode custom comments

Vscode custom comments

2022-04-23 06:35:00 Fan Ke

vscode As a tool for everyone's daily development , I won't say much more .
Importance of notes , In development, it can be said to be the top priority , And personalized custom notes , It can greatly improve our project development .

First step : Command Panel

  • Use ctrl + shift + p Call up the following window , And type snippets
     Insert picture description here

The second step :json File editing

  • Customize js Note as an example

 Insert picture description here

  • Enter into javascript.json After in file , Add the following code , You can customize the design , Save to exit , Here is a class annotation A method comment
  • Then, you can enter in the above of the method des, You can generate the comments you want .
  • prefix The content in the can be customized
  • phptscss And so on.
"Print to js class": {
    
    "prefix": "des",
    "body": [
      "/*",
      " *  author :  author ",
      " *  Time : ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
      " *  function : $0",
      " */"
    ],
},
"Print to js method": {
    
    "prefix": "des",
    "body": [
      "/*",
      " *  author :  author ",
      " *  Time : ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
      " *  function : $0",
      " */"
    ],
},

Add

  • I don't know if I didn't find , It's still about the version , I can't find it jsx Notes , But in js The configuration inside doesn't take effect . I tried to set it in the global code fragment , It works , If you don't find it jsx , Or you need your own comments json file , Just configure it in the global context .
     Insert picture description here
  • The content in the global code fragment is as follows
  • and js There is no difference between , hold js Changed to jsx
"Print to jsx class": {
    
    "prefix": "des",
    "body": [
      "/*",
      " *  author :  author ",
      " *  Time : ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
      " *  function : $0",
      " */"
    ],
},
"Print to jsx method": {
    
    "prefix": "des",
    "body": [
      "/*",
      " *  author :  author ",
      " *  Time : ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
      " *  function : $0",
      " */"
    ],
},

版权声明
本文为[Fan Ke]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210614037361.html