VSCode FileHeader
vscode文件头部注释插件,支持多语言,欢迎大家尝试,以及问题的提出,觉得不错的小伙伴们,给个Star,谢谢~
github: https://github.com/caizhengxin/vscodefileheader
Install
ext install jankincai.vscodefileheader
Features
- 支持自动更新最后修改人和时间
- 支持自定义模板(header/body)
- 支持多语言
- 支持后缀名映射模板
- 支持过滤,不添加头部注释
- 支持手动和自动插入头部注释
Usage
# Settings
{
"fileheader.author": "JanKinCai",
}
# Set save file or ``ctrl + alt + i`` insert comment
Demo
Python:
Vue:
XML:
Language
- ActionScript
- AppleScript
- ASP
- Batch
- C
- C#
- C++
- Clojire
- CSS
- D
- Diff
- Erlang
- Go
- Haskell
- HTML
- Java
- JavaScript
- LaTeX
- Lisp
- Lua
- Matlab
- Objective-C
- OCaml
- Pascal
- Perl
- PHP
- Python
- R
- Ruby
- Scala
- SCSS
- ShellScript
- SQL
- TypeScript
- Vue
- XML
- YAML
配置
- 设置作者
{
"fileheader.author": "Your name"
}
- 自定义后缀名映射
{
"fileheader.file_suffix_mapping": {
".pyx": "Python"
}
}
- 设置开启插入body
{
"fileheader.body": true
}
- 设置打开文件,自动插入头部注释
{
"fileheader.open": true,
}
- 设置保存文件, 自动插入头部注释, 默认
true
{
"fileheader.save": true,
}
如果设置为false
, 存在头部会自动更新最后修改人和时间,不存在头部需要按ctrl + alt + i
- 设置时间格式,参考
moment.js
{
"fileheader.dateformat": "YYYY-MM-DD HH:mm:ss" # moment.js
}
- 过滤不需要头部注释的文件
{
"fileheader.ignore": [
"*.txt",
"test.py",
"test"
]
}
- 自定义模板,例子
# 自定义Header模板
header模板路径:template/header/Python.tmpl,把下面的内容写入文件:
# -*- coding: utf-8 -*-
# @Author: {{author}}
# @Date: {{create_time}}
# @Last Modified by: {{last_modified_by}}
# @Last Modified time: {{last_modified_time}}
# 自定义Body模板
body模板路径:template/body/Python.tmpl,把下面的内容写入文件:
print("Hello, World!")
设置上面的template路径
{
"fileheader.custom_template_path": "xxx/template/"
}