vscode
  前一篇
# 键盘快捷方式
# C/C++相关
前置: 需要安装 C/C++插件

# 用户代码片段
# CPP自用
{
    "Add C include guard": {
        "scope": "c",
        "prefix": "cheader",
        "description": "Add include guard to C header file",
        "body": [
         "// Copyright (c) RealCoolEngineer. $CURRENT_YEAR. All rights reserved.",
         "// Author: beiklive",
         "// Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
         "",
        ]
       },
    "C/C++头文件": {
        "scope": "",
        "prefix": "#iff",
        "body": [
            "// Copyright (c) RealCoolEngineer. $CURRENT_YEAR. All rights reserved.",
            "// Author: beiklive",
            "// Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
            "#ifndef ${RELATIVE_FILEPATH/([a-zA-Z0-9]+)([\\/\\.-_])?/${1:/upcase}_/g}",
            "#define ${RELATIVE_FILEPATH/([a-zA-Z0-9]+)([\\/\\.-_])?/${1:/upcase}_/g}",
            "$1",
            "#endif  // ${RELATIVE_FILEPATH/([a-zA-Z0-9]+)([\\/\\.-_])?/${1:/upcase}_/g}",
            ""
        ],
        "description": "生成预定义宏"
    },
    ".cpp": {
        "prefix": "cc",
        "body": [
            "${TM_FILENAME_BASE}::"
        ],
        "description": "根据文件名生成命名空间名字"
    }
}
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
编辑  (opens new window)
  上次更新: 2024/05/20, 13:09:02