如何将以下行添加到我的 vs 代码 CPP 片段的正文中?
#define edl '\n'
"Print to #include <stdio.h>":{
"scope": "c,cpp",
"prefix": "std",
"body": [
"/* Hello Chen C program */",
"#include <stdio.h>",
"#include <stdlib.h>\n",
"int main(void)",
"{",
" ${1:printf(\"${2:Hello Chen\\n}\");}",
" ${3:system(\"pause\");}",
"}",
],
"description": "stdio.h"
},
我可以清楚地理解您的问题,只需复制和粘贴,不要忘记评分和投票
{ // 将 c 的片段放在这里。每个片段都在片段名称下定义,并具有前缀、正文和 // 描述。前缀是用来触发片段的,主体将被扩展和插入。可能的变量有: // $1, $2 用于制表位,$0 用于最终光标位置,${1:label}, ${2:another} 用于占位符。具有 // 相同 ID 的占位符已连接。// 示例: "打印到控制台": { "prefix": "jeetC", "body": [
"#include <stdio.h>",
"#include <conio.h>",
"#include <math.h>",
"#include <string.h>",
"#include <stdlib.h>",
"\n",
"int main()",
"{ $2 ",
" printf(\"\\n\");",
" printf(\"\\n\");",
"return 0;",
"}",
],
"description": "Log output to console"
}
}