VSCode JS自動生成可預覽的方法和類註釋
阿新 • • 發佈:2021-01-06
技術標籤:JavaScript JqueryVSCodeJSJavascript
主要使用的VSCode外掛為snippets
1.配置snippets外掛
使用ctrl + shift + p 調出如下視窗,並且輸入snippets
進入JS檔案的配置項
找到下拉列表裡的JavaScript.json,進入
3.設定註釋風格
給出一個註釋樣本,供參考
{ "Print to js class": { "prefix": "//class", "body": [ "/**", " *@Description: $0", " *@ClassAuthor: AuthorName", " *@Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}", "*/" ], }, "Print to js method": { "prefix": "//method", "body": [ "/**", " *@Description: $0", " *@MethodAuthor: AuthorName", " *@Date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}", "*/" ], }, }
其中prefix
的值是指輸入該值後自動生成註釋
4.預覽效果
參考:
https://www.jb51.net/article/194316.htm
https://www.csdn.net/tags/OtTaUg0sNTMzMi1ibG9n.html