vscode使用psioniq File Header自动添加文件头并保存最后更新时间

把快捷键写在前面以便查询:

  1. 插入文件头,按两次 ctrl+alt+H
  2. 插入Change Log,按两次 ctrl+alt+c
    注意mac也使用ctrl键而不是cmd键。
  1. 首先在扩展库中搜索psioniq File Header并点击安装。
  2. 设置-扩展中找到psioniq File Header
    在这里插入图片描述
    在这里插入图片描述
  3. 点击在settings.json中编辑

在这里插入图片描述,我的配置文件:

"psi-header.config": {
        "forceToTop": true,
        "blankLinesAfter": 3,
        "license": "Custom"
    },
"psi-header.changes-tracking": {
        "isActive": true,
        "modAuthor": "Modified By: ",
        "modDate": "Last Modified: ",
        "modDateFormat": "date",
        "include": [],
        "exclude": [
            "markdown",
            "json"
        ],
        "excludeGlob": [
            "out/**",
            "src/**/*.xyz",
            "components/**/*.mk",
        ],
        "autoHeader": "manualSave"
    },
    "psi-header.license-text": [
        "May the force be with you."
    ],
    "psi-header.variables": [
        ["company", "SimonLiu Inc."],
        ["author", "Simon Liu"],
        ["authoremail", "xxxxx@gmail.com"],
        ["initials","S.L"],
    ],
    "psi-header.lang-config": [
        {
            "language": "lua",
            "begin": "--[[",
            "prefix": "--",
            "end": "--]]",
            "blankLinesAfter": 0
        },
        {
            "language": "python",
            "begin": "###",
            "prefix": "# ",
            "end": "###",
            "blankLinesAfter": 0,
            "beforeHeader": [
                "#!/usr/bin/env python",
                "# -*- coding:utf-8 -*-"
            ]
        },
        {
            "language": "javascript",
            "begin": "/**",
            "prefix": " * ",
            "end": " */",
            "blankLinesAfter": 2,
            "forceToTop": false
        },
        {
            "language": "typescript",
            "mapTo": "javascript"
        }
    ],
    "psi-header.templates": [
        {
            "language": "c",
            "template": [
                "File: <<filepath>>",
                "Project: <<projectpath>>",
                "Created Date: <<filecreated('YYYY-MM-DD HH:mm:ss')>>",
                "Author: <<author>>",
                "-----",
                "Last Modified: <<dateformat('YYYY-MM-DD HH:mm:ss')>>",
                "Modified By: ",
                "-----",
                "Copyright (c) <<year>> <<company>>",
                "",
                "<<licensetext>>",
                "-----",
                "HISTORY:",
                "Date      \tBy\tComments",
                "----------\t---\t----------------------------------------------------------"
            ],
            "changeLogCaption": "HISTORY:",
            "changeLogHeaderLineCount": 2,
            "changeLogEntryTemplate": [
                "<<dateformat('YYYY-MM-DD')>>\t<<initials>>\t"
            ]
        },
        {
            "language": "javascript",
            "template": [
                "File: <<filepath>>",
                "Project: <<projectpath>>",
                "Created Date: <<filecreated('dddd, MMMM Do YYYY, h:mm:ss a')>>",
                "Author: <<author>>",
                "-----",
                "Last Modified: ",
                "Modified By: ",
                "-----",
                "Copyright (c) <<year>> <<company>>",
                "------------------------------------",
                "Javascript will save your soul!"
            ]
        },
        {
            "language": "typescript",
            "mapTo": "javascript"
        }
    ]
  1. 效果如下
    在这里插入图片描述
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值