Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>File Editor UtilsNew to Visual Studio Code? Get it now.
File Editor Utils

File Editor Utils

朱国森

|
472 installs
| (0) | Free
File Editor Utils: 1. Add Header Comment 2. Insert DateTime ...
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

文件编辑工具

github source

1. 添加文件开头注释

/*header
    > File Name: $file_name
    > Create Time: $datetime
    > Athor: $user_name
    > -----
    > Last Modified: $datetime
    > Modified By: $user_name
    > -----
*/

使用:

  1. Ctrl+Shift+P,搜索Insert Header Comment
  2. 快捷键:ctrl+alt+H ctrl+alt+H

特点或限制:

  1. 模板对所有的语言一样,除了块注释符
  2. 文件保存时,自动更新或插入注释【条件是block_comment里配置了对于的语言】

配置:

  1. template_create 创建注释 字符串数组
  2. template_modify 修改注释 字符串数组
  3. block_comment= [language_*]["/*","*/"] 块注释开头结尾,vscode没有提供获取语言配置的接口,蛋疼。
  4. date_format=yyyy-mm-dd 星期几 HH时MM分ss秒
    • 使用dateformat模块,格式参考之
    • 特别的:星期几替换星期[日一二三四五六]
  5. auto_insert_when_save 是否在保存时自动添加,默认是false。
  6. user_name 用户名,默认使用username取到的名字。

模版变量$name:

  1. file_name
  2. user_name
  3. datetime

坑

  1. 插件商店直接搜索安装,提示找不到命令。
    1. 最终发现在插件目录执行npm install,然后就好了~~
    2. 后续:发现把devDependencies下的依赖全部拷贝到dependencies里就好了。
  2. 其他
    1. 开发时不要使用cnpm install,安装了些软连接文件夹,复制到插件目录,不生效。马丹,改了不少文件名。 可以设置npm使用淘宝链接npm config -g set registry https://registry.npm.taobao.org/。

dependencies

This extension uses the following npm packages:

  • username to get the default author name.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft