Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Auto HeaderNew to Visual Studio Code? Get it now.
Auto Header

Auto Header

anaer

|
639 installs
| (0) | Free
This extension allows quickly add file header in the active text editor. And also allows to update the modify time and modifier automatic in the file header comments.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

修改说明

  1. 去掉代码中的空格拼接符, 完全根据配置信息进行配置
  2. 添加markdown文件头格式
  3. 调整package.json, 去掉无用配置
  4. 为了减少扩展包大小, 去掉moment依赖, 使用原生日期格式化, 只支持yyyy|MM|dd|HH|mm|ss这6项配置
  5. 当createTime配置项值为空时, 保存时自动填充文件的创建时间

auto-header

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

  1. Install Visual Studio Code 1.1.0 or higher
  2. Launch Code
  3. From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX)
  4. Select Install Extension
  5. Type auto-header and press enter
  6. Reload Visual Studio Code

Config

  • default 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
  1. From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX)
  2. Type the Settings to select and open Settings(JSON)
  3. 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

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft