修改说明
- 去掉代码中的空格拼接符, 完全根据配置信息进行配置
- 添加markdown文件头格式
- 调整package.json, 去掉无用配置
- 为了减少扩展包大小, 去掉moment依赖, 使用原生日期格式化, 只支持yyyy|MM|dd|HH|mm|ss这6项配置
- 当createTime配置项值为空时, 保存时自动填充文件的创建时间
This extension allows quickly add file header in the active text editor.
And also allows update the modify time and modifier automatic in the file header comments
Changelog
1.0.0
- Support quickly add file header from the command palette
Ctrl
-Alt
-I
(Windows, Linux) or Cmd
-Alt
-I
(OSX)
- Support update the modify time and modifier automatic when the file did save
Installation
- Install Visual Studio Code 1.1.0 or higher
- Launch Code
- From the command palette
Ctrl
-Shift
-P
(Windows, Linux) or Cmd
-Shift
-P
(OSX)
- Select
Install Extension
- Type
auto-header
and press enter
- Reload Visual Studio Code
Config
"autoHeader": {
"format": {
"startWith": "/**",
"middleWith": " * ",
"endWith": " */",
"headerPrefix": "@",
},
"header": {
"Author": "Your name",
"Create Time": {
"type": "createTime",
"format": "yyyy-MM-dd HH:mm:ss",
},
"Modified by": {
"type": "modifier",
"value": "Your name",
},
"Modified time": {
"type": "modifyTime",
"format": "yyyy-MM-dd HH:mm:ss"
},
"Description": "",
}
}
- support customer configuration
- From the command palette
Ctrl
-Shift
-P
(Windows, Linux) or Cmd
-Shift
-P
(OSX)
- Type the
Settings
to select and open Settings(JSON)
- Add the configurations like this:
"autoHeader": {
"format": {
"startWith": "/**",
"middleWith": " * ",
"endWith": " */",
"headerPrefix": "@",
},
"header": {
"Author": "Daniel Lin",
"Create Time": {
"type": "createTime",
"format": "yyyy-MM-dd HH:mm:ss",
},
"Modified by": {
"type": "modifier",
"value": "Daniel Lin",
},
"Modified time": {
"type": "modifyTime",
"format": "yyyy-MM-dd HH:mm:ss"
},
"Description": "",
}
}
Attribute: format
This attribute support to config [startWith
, middleWith
, endWith
, headerPrefix
] of the file header comments
It will use default configuration when it missing
Attribute: header
This attribute support to config the file header template
It will use default configuration when it missing
How to config the template in Attribute: header
This attribute of header use [key
, value
] to config the file header template
The value of each attribute can be a string
or an object
If the value typeof object
, it support type:
'createTime',
'modifyTime',
'modifier',
When you select [createTime
, modifyTime
], you can set the format of the time
If you are not setting the format of the time, it will use the format like yyyy-MM-dd HH:mm:ss
When you select [modifier
], this attribute will use to update the modifier
in the file header comments when the text editor did save
You can use [key
, value
] to add your customize file header templte
But the type of [createTime
, modifyTime
, modifier
] can only be used once
License
MIT