{
"c file header": {
"prefix": "H", //在新建立的页面中输入 H 就会有智能提示,Tab就自动生成好了
"body": [
"#ifndef _$0_H",
"#define _$0_H",
"#ifdef __cplusplus ///<use C compiler ",
"extern \"C\"",
"{",
"#endif ",
"/** Includes -----------------------------------------------------------------*/",
"#include <stdint.h> /**< need definition of uint8_t */ ",
"#include <stddef.h> /**< need definition of NULL */ ",
"#include <stdbool.h>/**< need definition of BOOL */ ",
"#include <stdio.h> /**< if need printf */ ",
"/** Private includes ---------------------------------------------------------*/",
" ",
"/** Private defines ----------------------------------------------------------*/",
" ",
"/** Exported typedefines -----------------------------------------------------*/",
" ",
"/** Exported constants -------------------------------------------------------*/",
" ",
"/** Exported macros-----------------------------------------------------------*/",
"",
"/** Exported variables -------------------------------------------------------*/",
"/** Exported functions prototypes --------------------------------------------*/",
" ",
"#ifdef __cplusplus ///<end extern c ",
"}",
"#endif ",
"#endif ",
"/******************************** End of file *********************************/"
],
"description": "A c file template." //用户输入后智能提示的内容(你可以用中文写“生成C++模板”)
},
"c file": {
"prefix": "C",
"body": [
"/** ",
"* @file",
"* @date ",
"* @author [email protected]",
"* @brief None.",
"* @details None",
"* @version V1.0",
"*/",
"#ifdef __cplusplus ///<use C compiler",
"extern \"C\" {",
"#endif",
"/** Includes -----------------------------------------------------------------*/",
"#include <time.h>",
"/* Private includes ----------------------------------------------------------*/",
"",
"/** Private typedef ----------------------------------------------------------*/",
" ",
"/** Private macros -----------------------------------------------------------*/",
"#define LOG_TAG \"$1\"",
"",
"/** Private constants --------------------------------------------------------*/",
"",
"/** Public variables ---------------------------------------------------------*/",
"",
"/** Private variables --------------------------------------------------------*/",
" ",
"/** Private function prototypes ----------------------------------------------*/",
" ",
"/** Private user code --------------------------------------------------------*/ ",
" ",
"/** Private application code -------------------------------------------------*/",
"/*******************************************************************************",
"* Static code ",
"********************************************************************************",
"*/ ",
"$2",
"",
"/** Public application code --------------------------------------------------*/",
"/*******************************************************************************",
"* Public code ",
"********************************************************************************",
"*/",
"$3",
"",
"#ifdef __cplusplus ///<end extern c ",
"} ",
"#endif ",
"/******************************** End of file *********************************/"
],
"description": "A c header file comment."
},
"multi-line comment": {
"prefix": "mc",
"body": "/*\n * ${1:多行注释}\n */$0"
},
"single line comment": {
"prefix": "sc",
"body": "/* ${1:单行注释} */$0"
},
"main()": {
"prefix": "main",
"body": "int main(int argc, char const *argv[])\n{\n\t$0\n\treturn 0;\n}"
},
"For Loop": {
"prefix": "for",
"body": "for (${1:int} ${2:i} = ${3:0}; ${2:i} ${4:<} ${5:count}; ${2:i}${6:++}) {\n\t$0\n}"
},
"Define and For Loop": {
"prefix": "dfor",
"body": "int ${1:i};\nfor (${1:i} = ${2:0}; ${1:i} < ${3:count}; ${1:i}${4:++}) {\n\t$0\n}"
},
"else if": {
"prefix": "else if",
"body": "else if ($0) {\n\t\n}"
},
"case break": {
"prefix": "case",
"body": "case $0:\n\t\n\tbreak;\n"
},
"printf": {
"prefix": "printf",
"body": "printf(\"${1:%s}\\n\", $2);$3"
},
"array size": {
"prefix": "asize",
"body": "sizeof(${1:arrayName})/sizeof($1[0])"
},
"define ARRAY_SIZE macro": {
"prefix": "defas",
"body": "#define ARRAY_SIZE(${1:arrayName}) (sizeof($1)/sizeof($1[0]))\n$0"
},
"define MAX": {
"prefix": "defmax",
"body": "#define MAX(x, y) ((x) > (y) ? (x) : (y))"
},
"define MIN": {
"prefix": "defmin",
"body": "#define MIN(x, y) ((x) < (y) ? (x) : (y))"
},
"Header Include-Guard": {
"prefix": "once",
"body": "#ifndef ${1:SYMBOL}\n#define $1\n\n$0\n\n#endif /* $1 */"
},
"Typedef": {
"prefix": "typedef",
"body": "typedef ${1:int} ${2:MyCustomType};"
},
"#ifndef … #define … #endif": {
"prefix": "def",
"body": "#ifndef ${1:SYMBOL}\n#define $1 ${2:value}\n#endif\t// ${1:SYMBOL}"
},
"#include <>": {
"prefix": "Inc",
"body": "#include <${1:.h}>"
},
"#include \"\"": {
"prefix": "inc",
"body": "#include \"${1:.h}\""
},
"#pragma mark": {
"prefix": "mark",
"body": "#if 0\n${1:#pragma mark -\n}#pragma mark $2\n#endif\n\n$0"
},
"fprintf": {
"prefix": "fprintf",
"body": "fprintf(${1:stderr}, \"${2:%s}\\\\n\", $3);$4"
},
"scanf": {
"prefix": "scanf",
"body": "scanf(\"${1:%s}\\n\", $2);$3"
},
"void": {
"prefix": "void",
"body": "void ${1:func}($2) {\n\t$3\n}"
},
"any function": {
"prefix": "func",
"body": "${1:int} ${2:func}($3) {\n\t$5\n\treturn ${4:0};\n}"
},
"write file": {
"prefix": "wf",
"body": "FILE *${1:fp};\n${1:fp} = fopen (\"${2:filename.txt}\",\"w\");\nif (${1:fp}!=NULL)\n{\n\tfprintf(${1:fp},\"${3:Some String\\\\n}\");\n\tfclose (${1:fp});\n}"
},
"read file": {
"prefix": "rf",
"body": "FILE *${1:fp};\n${1:fp} = fopen (\"${2:filename.txt}\",\"r\");\nif (${1:fp}!=NULL)\n{\n\tfscanf(${1:fp},\"${3:Some String\\\\n}\", ${3:&var});\n\tfclose (${1:fp});\n}",
"description": "read file opeartion including fopen, fscanf and fclose."
}
}
vscode user snippets实现c语言自动填充
猜你喜欢
转载自blog.csdn.net/star871016/article/details/108964468
今日推荐
周排行