Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code VS代码为源文件自动设置许可证标题_Visual Studio Code_Vscode Settings_Vscode Extensions_Psioniq - Fatal编程技术网

Visual studio code VS代码为源文件自动设置许可证标题

Visual studio code VS代码为源文件自动设置许可证标题,visual-studio-code,vscode-settings,vscode-extensions,psioniq,Visual Studio Code,Vscode Settings,Vscode Extensions,Psioniq,我不熟悉VS代码,因为我大部分时间都在使用IntelliJ。我现在想在VS代码中全局设置许可证标题作为模板,以便在我创建的任何新文件上自动应用它 我安装了psioniq psi header,并尝试按照文档进行操作,但我不确定如何设置它。根据文档,我需要点击F1并输入Header Change Log Insert,但一旦我这样做,就会看到一条错误消息,如下面的屏幕所示: 知道问题可能是什么吗?我自己想出来的,下面是我必须做的: 要将标题配置为模板,我必须通过从文件->首选项->设置导航打开s

我不熟悉VS代码,因为我大部分时间都在使用IntelliJ。我现在想在VS代码中全局设置许可证标题作为模板,以便在我创建的任何新文件上自动应用它

我安装了psioniq psi header,并尝试按照文档进行操作,但我不确定如何设置它。根据文档,我需要点击F1并输入Header Change Log Insert,但一旦我这样做,就会看到一条错误消息,如下面的屏幕所示:


知道问题可能是什么吗?

我自己想出来的,下面是我必须做的:

要将标题配置为模板,我必须通过从文件->首选项->设置导航打开settings.json,然后按照下面的屏幕截图进行操作

My settings.json包含以下内容:

{
    "workbench.iconTheme": "vscode-icons",
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "files.autoSave": "afterDelay",
    "psi-header.variables": [
        ["author", "myuser"],
        ["url", "<https://my.github.com/myuser>"]
    ],
    "psi-header.templates": [
        {
            "language": "*",
            "template": [
                "Copyright (c) <<year>> <<author>> <<url>>",
                "",
                "Created Date: <<filecreated('dddd, MMMM Do YYYY, h:mm:ss a')>>",
                "Author: <<author>>",
                "",
                "Redistribution and use in source and binary forms, with or without",  
                "modification, are permitted provided that the following conditions are", 
                "met:",
                "",
                "1. Redistributions of source code must retain the above copyright notice,", 
                "this list of conditions and the following disclaimer.",
                "",
                "2. Redistributions in binary form must reproduce the above copyright", 
                "notice, this list of conditions and the following disclaimer in the",   
                "documentation and/or other materials provided with the distribution.",
                "",
                "3. Neither the name of the copyright holder nor the names of its", 
                "contributors may be used to endorse or promote products derived from this",
                "software without specific prior written permission.",
                "",
                "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS", 
                "IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,", 
                "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ",
                "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR", 
                "CONTRIBUTORS BE", 
                "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR",
                "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF", 
                "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS", 
                "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN", 
                "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)", 
                "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF", 
                "THE POSSIBILITY OF SUCH DAMAGE.",
                "",
                "HISTORY:",
                "Date      \tBy\tComments",
                "----------\t---\t----------------------------------------------------------"
            ],
            "changeLogCaption": "HISTORY:",
            "changeLogHeaderLineCount": 2,
            "changeLogEntryTemplate": [
                "<<dateformat('YYYY-MM-DD')>>\t<<initials>>\t"
            ]
        }
    ]
}
{
“workbench.iconTheme”:“vscode图标”,
“workbench.editorAssociations”:[
{
“视图类型”:“jupyter.notebook.ipynb”,
“文件名模式”:“*.ipynb”
}
],
“files.autoSave”:“afterDelay”,
“psi标题.变量”:[
[“作者”、“我的用户”],
[“url”,“”]
],
“psi标题.模板”:[
{
“语言”:“*”,
“模板”:[
“版权(c)”,
"",
“创建日期:”,
“作者:”,
"",
“以源代码和二进制形式重新分发和使用,带或不带”,
“如果满足以下条件,则允许进行修改”,
“大都会:”,
"",
“1.源代码的重新分发必须保留上述版权声明,”,
“此条件列表和以下免责声明。”,
"",
“2.以二进制形式重新分发必须复制上述版权”,
“注意,此条件列表和以下免责声明”,
“随分发提供的文件和/或其他材料。”,
"",
“3.版权持有人的姓名或其代理人的姓名”,
“投稿人可用于支持或推广由此衍生的产品”,
“未经事先书面许可的软件。”,
"",
“本软件由版权所有者和贡献者提供,作为”,
“是及任何明示或默示保证,包括但不限于,”,
“特定产品适销性和适用性的默示保证”,
“不声明目的。在任何情况下,版权持有人或”,
“贡献者是”,
“对任何直接、间接、附带、特殊、示范或,
“间接损害(包括但不限于采购”,
“替代商品或服务;使用、数据或利润损失;或业务”,
“中断)无论是何种原因造成的,且基于任何责任理论,无论是在“,
“合同、严格责任或侵权行为(包括疏忽或其他)”,
“以任何方式因使用本软件而产生,即使被告知”,
“这种损害的可能性。”,
"",
“历史:”,
“日期\tBy\t注释”,
“------------\t-----\t-------------------------------------------”
],
“changeLogCaption”:“历史记录:”,
“changeLogHeaderLineCount”:2,
“changeLogEntryTemplate”:[
“\t\t”
]
}
]
}
这样将生成一个头文件,如下所示:

/*
 * Copyright (c) 2020 myuser <https://my.github.com/myuser>
 * 
 * Created Date: Thursday, October 29th 2020, 9:08:05 am
 * Author: myuser
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. Neither the name of the copyright holder nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS
 * IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * HISTORY:
 * Date         By  Comments
 * ----------   --- ----------------------------------------------------------
 */
/*
*版权所有(c)2020 myuser
* 
*创建日期:2020年10月29日星期四上午9:08:05
*作者:myuser
* 
*以源代码和二进制形式重新分发和使用,带或不带
*如果满足以下条件,则允许修改
*会议:
* 
* 1. 源代码的重新分发必须保留上述版权声明,
*此条件列表和以下免责声明。
* 
* 2. 以二进制形式重新分发必须复制上述版权
*请注意,此条件列表和中的以下免责声明
*随分发提供的文件和/或其他材料。
* 
* 3. 版权持有人的姓名或其代理人的姓名
*投稿人可用于支持或推广由此衍生的产品
*未经事先书面许可的软件。
* 
*本软件由版权所有人和贡献者提供
*以及任何明示或暗示的保证,包括但不限于:,
*对特定产品的适销性和适用性的默示保证
*目的是否认。在任何情况下,版权持有人或
*贡献者是
*对任何直接、间接、附带、特殊、示范或
*间接损害(包括但不限于采购
*替代商品或服务;使用、数据或利润的损失;或业务
*中断)无论是何种原因造成的,且基于任何责任理论,无论是在
*合同、严格责任或侵权行为(包括疏忽或其他)
*因使用本软件而产生的任何后果,即使
*这种损害的可能性。
* 
*历史:
*评论日期
* ----------   --- ----------------------------------------------------------
*/

我自己想出来了,下面是我必须做的:

要将标题配置为模板,我必须通过从文件->首选项->设置导航打开settings.json,然后按照下面的屏幕截图进行操作

My settings.json包含以下内容:

{
    "workbench.iconTheme": "vscode-icons",
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "files.autoSave": "afterDelay",
    "psi-header.variables": [
        ["author", "myuser"],
        ["url", "<https://my.github.com/myuser>"]
    ],
    "psi-header.templates": [
        {
            "language": "*",
            "template": [
                "Copyright (c) <<year>> <<author>> <<url>>",
                "",
                "Created Date: <<filecreated('dddd, MMMM Do YYYY, h:mm:ss a')>>",
                "Author: <<author>>",
                "",
                "Redistribution and use in source and binary forms, with or without",  
                "modification, are permitted provided that the following conditions are", 
                "met:",
                "",
                "1. Redistributions of source code must retain the above copyright notice,", 
                "this list of conditions and the following disclaimer.",
                "",
                "2. Redistributions in binary form must reproduce the above copyright", 
                "notice, this list of conditions and the following disclaimer in the",   
                "documentation and/or other materials provided with the distribution.",
                "",
                "3. Neither the name of the copyright holder nor the names of its", 
                "contributors may be used to endorse or promote products derived from this",
                "software without specific prior written permission.",
                "",
                "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS", 
                "IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,", 
                "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ",
                "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR", 
                "CONTRIBUTORS BE", 
                "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR",
                "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF", 
                "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS", 
                "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN", 
                "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)", 
                "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF", 
                "THE POSSIBILITY OF SUCH DAMAGE.",
                "",
                "HISTORY:",
                "Date      \tBy\tComments",
                "----------\t---\t----------------------------------------------------------"
            ],
            "changeLogCaption": "HISTORY:",
            "changeLogHeaderLineCount": 2,
            "changeLogEntryTemplate": [
                "<<dateformat('YYYY-MM-DD')>>\t<<initials>>\t"
            ]
        }
    ]
}
{
“workbench.iconTheme”:“vscode图标”,