vscode下python的头部、函数注释配置
1.下载插件koroFileHeader
2.打开插件配置setting.json,添加或修改以下配置:
{
"fileheader.cursorMode": {
"description": "",
"param": "",
"return": "",
},
"fileheader.customMade": {
"Author": "",
"Date": "Do not edit", // 文件创建时间(不变)
"Email": "",
"LastEditors": "", // 文件最后编辑者
"LastEditTime": "Do not edit", // 文件最后编辑时间
"FilePath": "Do not edit", // 文件在项目中的相对路径 自动更新
"Description": "Do edit!"
},
// 不填写对应属性即关闭对应功能
"fileheader.configObj": {
"beforeAnnotation": {
"py": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-", // py文件默认,可修改
"*": "\n" // 所有文件的头部注释都在前面增加一个换行(除了py)
},
"afterAnnotation": {
"py": "\ndef test():\n\t'''\n\t@ description: \n\t@ param {type} \n\t@ return: \n\t'''\n\tpass\n\nif __name__ == \"__main__\":\n\ttest()", // py文件默认,可修改
"*": "\n" // 所有文件的头部注释都在前面增加一个换行(除了py)
}, // 需要特殊定制的文件后缀
"language": {
// 普通后缀文件
"python": {
"head": "'''",
"middle": "@ ",
"end": "'''"
}
},
"autoAdd": true, // 默认开启
"autoAlready": true, // 默认开启
"createHeader": true // 默认打开
}
}