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