?1、安裝插件
?2、CTRL + , 打開設(shè)置,輸入?fileheader ,進(jìn)入?setting.json 配置相關(guān)信息
3、 將下方代碼,插入 setting.json,有不需要的字段,可以刪掉
// 頭部注釋
"fileheader.customMade": {
// Author字段是文件的創(chuàng)建者 可以在specialOptions中更改特殊屬性
// 公司項(xiàng)目和個(gè)人項(xiàng)目可以配置不同的用戶名與郵箱 搜索: gitconfig includeIf 比如: https://ayase.moe/2021/03/09/customized-git-config/
// 自動提取當(dāng)前git config中的: 用戶名、郵箱
"Author": "git config user.name && git config user.email", // 同時(shí)獲取用戶名與郵箱
// "Author": "git config user.name", // 僅獲取用戶名
// "Author": "git config user.email", // 僅獲取郵箱
// "Author": "OBKoro1", // 寫死的固定值 不從git config中獲取
"Date": "Do not edit", // 文件創(chuàng)建時(shí)間(不變)
// LastEditors、LastEditTime、FilePath將會自動更新 如果覺得時(shí)間更新的太頻繁可以使用throttleTime(默認(rèn)為1分鐘)配置更改更新時(shí)間。
"LastEditors": "git config user.name && git config user.email", // 文件最后編輯者 與Author字段一致
// 由于編輯文件就會變更最后編輯時(shí)間,多人協(xié)作中合并的時(shí)候會導(dǎo)致merge
// 可以將時(shí)間顆粒度改為周、或者月,這樣沖突就減少很多。搜索變更時(shí)間格式: dateFormat
"LastEditTime": "Do not edit", // 文件最后編輯時(shí)間
// 輸出相對路徑,類似: /文件夾名稱/src/index.js
"FilePath": "Do not edit", // 文件在項(xiàng)目中的相對路徑 自動更新
// 插件會自動將光標(biāo)移動到Description選項(xiàng)中 方便輸入 Description字段可以在specialOptions更改
"Description": "", // 介紹文件的作用、文件的入?yún)?、出參? // custom_string_obkoro1~custom_string_obkoro100都可以輸出自定義信息
// 可以設(shè)置多條自定義信息 設(shè)置個(gè)性簽名、留下QQ、微信聯(lián)系方式、輸入空行等
"custom_string_obkoro1": "",
// 版權(quán)聲明 保留文件所有權(quán)利 自動替換年份 獲取git配置的用戶名和郵箱
// 版權(quán)聲明獲取git配置, 與Author字段一致: ${git_name} ${git_email} ${git_name_email}
"custom_string_obkoro1_copyright": "Copyright (c) ${now_year} by git config user.name , All Rights Reserved. "
// "custom_string_obkoro1_copyright": "Copyright (c) ${now_year} by 寫死的公司名/用戶名, All Rights Reserved. "
},
// 函數(shù)注釋
"fileheader.cursorMode": {
"description": "", // 函數(shù)注釋生成之后,光標(biāo)移動到這里
"param": "", // param 開啟函數(shù)參數(shù)自動提取 需要將光標(biāo)放在函數(shù)行或者函數(shù)上方的空白行
"return": "",
}
4、保存設(shè)置,重啟vscode,就可以使用了
? ? ? ? (1)文件頭部注釋: CTRL+Win+i?(Ctrl + Alt + i)?(Windows)、 CTRL+cmd+i?(mac)
? ? ? ? (2)函數(shù)注釋: 將鼠標(biāo)光標(biāo)移到函數(shù)名那一行或其上方的空白行,按快捷鍵?CTRL+Win+t?(Ctrl + Alt + t)?(Windows)、 CTRL+alt+t (mac)
?
附: 若 快捷鍵沖突不起作用,可以自定義快捷鍵:
1)、打開鍵盤快捷方式
?2)、依次搜索?fileheader 、cursorTip 進(jìn)行修改
?文章來源:http://www.zghlxwxcb.cn/news/detail-686482.html
參考:https://www.cnblogs.com/iooz/p/16550640.html文章來源地址http://www.zghlxwxcb.cn/news/detail-686482.html
到了這里,關(guān)于VS Code——koroFileHeader插件:生成頭部注釋、函數(shù)注釋的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!