VSCode 常用配置

1、VSCode KoroFileHeader 注释插件(支持多种语言,可自定义)

 

2、Draw.io Integration绘图

 

3、vscode配置

点击左下角设置->用户代码片段->新建全局代码片段文件

输入:snipet.code-snippets

粘贴:

{
    // Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and 
    // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope 
    // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is 
    // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: 
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. 
    // Placeholders with the same ids are connected.
    // Example:
    // "Print to console": {
    //     "scope": "javascript,typescript",
    //     "prefix": "log",
    //     "body": [
    //         "console.log('$1');",
    //         "$2"
    //     ],
    //     "description": "Log output to console"
    // }

    "FILE_HEADER":{
        "prefix": "file_header",
        "description": "文件头",
        "body": [
            "/**",
            " * @file    $TM_FILENAME",
            " * @note    Hangzhou Hikvision Automotive Technology Co., Ltd. All Right Reserved.",
            " * @brief   ${1:简介}",
            " *",
            " * ${2:详细说明}",
            " *",
            " * @method  ${8:1.方法1说明}",
            " *          ${0:2.方法2说明}",
            " * @author  pfx",
            " * @date    $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
            " * @version ${4:1}.${5:0}.${6:0} $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE ${7:新建文件}",
            " */",
        ]
    },
    "FUNCTION_HEADER":{
        "prefix": "function_header",
        "description": "函数头",
        "body": [
            "/**",
            " * @fn         ${1:函数名}",
            " * @brief      ${2:函数说明}",
            " * @param[in]  ${4:参数说明}",
            " * @param[out] ${5:参数说明}",
            " * @return     ${6:返回值说明}",
            " * @note       ",
            " */",
        ]
    },
    "STRUCT_HEADER":{
        "prefix": "struct_header",
        "description": "结构体头",
        "body": [
            "/**",
            " * @struct ${1:结构名}",
            " * @brief  ${2:结构说明}",
            " * @note   8bytes对齐",
            " */$0",
        ]
    },
    "ENUM_HEADER":{
        "prefix": "enum_header",
        "description": "枚举头",
        "body": [
            "/**",
            " * @enum   ${1:枚举名}",
            " * @brief  ${2:枚举说明}",
            " */$0",
        ]
    },
    "TODO_COMMENT":{
        "prefix": "todo",
        "description": "TODO注释",
        "body": [
            "/* @todo (yanghongling:hikvision.com.cn): $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
            "   ${1:need todo in future}",
            "*/",
        ]
    },
    "HEADER_GUARD":{
        "prefix": "header_guard",
        "description": "头文件卫士",
        "body": [
            "#ifndef __${TM_FILENAME_BASE/([a-z_]*)+/${1:/upcase}/}_H__",
            "#define __${TM_FILENAME_BASE/([a-z_]*)+/${1:/upcase}/}_H__",
            "",
            "#ifdef __cplusplus",
            "    extern \"C\" {",
            "#endif",
            "",
            "$0",
            "",
            "#ifdef __cplusplus",
            "    }",
            "#endif  /*! ifdef __cplusplus*/",
            "",
            "#endif  /*! __${TM_FILENAME_BASE/([a-z_]*)+/${1:/upcase}/}_H__ */",
            "",
        ]
    },
    "RETURE_CHECK":{
        "prefix": "if_ret",
        "description": "返回值校验",
        "body": [
            "if(iRet < 0)",
            "{",
            "    FILE_ERROR(\"func failed.\\n\");",
            "    return ERROR;",
            "}",
        ]
    },
}
snipet.code-snippets

 

保存。

 3、插件

koroFileHeader

koroFileHeader: 继承自github上的开源项目koroFileHeader,该VSCode插件可以方便的添加文件头注释和函数注释,原版本维护到4.9.3后,已经有1年左右没有发布新的版本,本人在使用过程中对遇到的问题和不足进行更新,由于github访问经常故障,故在宝地归档。 (gitee.com)

posted @ 2023-07-31 15:28  墨尔基阿德斯  阅读(23)  评论(0编辑  收藏  举报