itgoyo / 500Days-Of-Github

⭐ 瞎JB折腾Mac/Linux/Windows过程中遇到的所有问题和解决方式 ⭐

Home Page:https://itgoyo.github.io/500Days-Of-Github

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VSCode C

itgoyo opened this issue · comments

{
	// Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and
	// description. 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": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"init main": {
		"prefix": "main",
		"body": [
			"#include <stdio.h>",
			"#include <stdlib.h>",
			"#include <string.h>",
			"",
			"int main(int argc, char *argv[])",
			"{",
			"    $1",
			"    return 0;",
			"}"
		],
		"description": "Basic main function"
	},
	"Print format": {
		"prefix": "prin",
		"body": [
			"printf(\"$1\",$2);"
		],
		"description": "Quick print format"
	},
	"Print message": {
		"prefix": "pr",
		"body": [
			"printf(\"$1\");"
		],
		"description": "Quick print format"
	},
	"sizeof": {
		"prefix": "si",
		"body": [
			"sizeof(${1:name})"
		],
		"description": "sizeof(name)"
	},
	"for": {
		"prefix": "for",
		"body": [
			"for (${int} ${i} = ${1:0}; ${i} < ${2:length}; ${i}++)",
			"{",
			"    $3",
			"}"
		],
		"description": "Code snippet for 'for' loop"
	},
	"forj": {
		"prefix": "forj",
		"body": [
			"for (${int} ${j} = ${1:0}; ${j} < ${2:length}; ${j}++)",
			"{",
			"    $3",
			"}"
		],
		"description": "Code snippet for 'for' loop"
	},
	"fork": {
		"prefix": "fork",
		"body": [
			"for (${size_t} ${k} = ${1:0}; ${k} < ${2:length}; ${k}++)",
			"{",
			"    $3",
			"}"
		],
		"description": "Code snippet for 'for' loop"
	},
	"forr": {
		"prefix": "forr",
		"body": [
			"for (int ${i} = ${1:length} - 1; ${i} >= ${2:0}; ${i}--)",
			"{",
			"    $3",
			"}"
		],
		"description": "Code snippet for reverse 'for' loop"
	},
	"while": {
		"prefix": "while",
		"body": [
			"while ($1)",
			"{",
			"    $2",
			"}"
		],
		"description": ""
	},
	"if": {
		"prefix": "if",
		"body": [
			"if ($1)",
			"{",
			"    $2",
			"}"
		],
		"description": "Code snippet for if statement"
	},
	"else": {
		"prefix": "else",
		"body": [
			"else",
			"{",
			"    $1",
			"}"
		],
		"description": "Code snippet for else statement"
	},
	"else if": {
		"prefix": "else if",
		"body": [
			"else if ($1)",
			"{",
			"    $2",
			"}"
		],
		"description": "Code snippet for else-if statement"
	},
	"enum": {
		"prefix": "enum",
		"body": [
			"enum ${1:MyEnum}",
			"{",
			"    $2",
			"};"
		],
		"description": "Code snippet for enum"
	},
	"#ifdef": {
		"prefix": "#ifdef",
		"body": [
			"#ifdef ${DEBUG}",
			"$1",
			"#endif // ${DEBUG}"
		],
		"description": "Code snippet for #ifdef"
	},
	"#ifndef": {
		"prefix": "#ifndef",
		"body": [
			"#ifndef ${1:1}",
			"$2",
			"#endif // !$1"
		],
		"description": "Code snippet for #ifndef"
	},
	"#if": {
		"prefix": "#if",
		"body": [
			"#ifdef ${1:0}",
			"$2",
			"#endif // $1"
		],
		"description": "Code snippet for #if"
	},
	"struct": {
		"prefix": "str",
		"body": [
			"struct ${1:MyStruct}",
			"{",
			"    $2",
			"};"
		],
		"description": "Code snippet for struct"
	},
	"switch": {
		"prefix": "switch",
		"body": [
			"switch (${switch_on})",
			"{",
			"default:",
			"    break;$1",
			"}"
		],
		"description": "Code snippet for switch statement"
	},
	"switc": {
		"prefix": "sw",
		"body": [
			"switch($1)",
			"{",
			"    {",
			"    case $2:",
			"        $3",
			"        break;",
			"    default:",
			"        ",
			"        break;",
			"    }",
			"}",
		],
		"description": "switch(){}"
	},
	"switch2": {
		"prefix": "switch",
		"body": [
			"switch($1){",
			"{",
			"    case $2:",
			"        $3",
			"        break;",
			"    default:",
			"        ",
			"        break;",
			"}"
		],
		"description": "switch(){}"
	},
	"case": {
		"prefix": "ca",
		"body": [
			"case $1:",
			"    $3",
			"    break;"
		],
		"description": "case:break;"
	},
	"case2": {
		"prefix": "case",
		"body": [
			"case $1:",
			"    $3",
			"    break;"
		],
		"description": "case:break;"
	},
	"union": {
		"prefix": "union",
		"body": [
			"union ${MyUnion}",
			"{",
			"    $1",
			"};"
		],
		"description": "Code snippet for union"
	},
	"#inc": {
		"prefix": "#inc",
		"body": [
			"#include \"$1\""
		],
		"description": "Code snippet for #include \" \""
	},
	"#inc<": {
		"prefix": "#inc<",
		"body": [
			"#include <$1>"
		],
		"description": "Code snippet for #include \" \""
	},
	"#def": {
		"prefix": "#def",
		"body": [
			"#define \"$1\" \"$2\" "
		],
		"description": "Code snippet for #define \" \""
	},
	"add  fun(){}": {
		"prefix": "fun",
		"body": [
			"${1:functionname}(${2:void})",
			"{",
			"    $3",
			"}"
		],
		"description": "add @funtionname(@arg){}"
	},
	"add fun(){}": {
		"prefix": "fu",
		"body": [
			"${1:functionname}(${2:args})",
			"{",
			"    $3",
			"}"
		],
		"description": "add @funtionname(@arg){}"
	}