vscode——如何自定代码块和调用代码块

3.在vscode左下方(像齿轮一样图标)——>选择"用户代码片段"——>如图:

vscode——如何自定代码块和调用代码块_第1张图片

4.如图:

vscode——如何自定代码块和调用代码块_第2张图片

—>选择html点击——>html.json格式——>如图:

vscode——如何自定代码块和调用代码块_第3张图片

5.把这段代码:
"HTML template":{
		"prefix": "cc",
		"body":[
			"",
			"",
			"",
			"\t",
			"\t${1:Page Title}",
			"",
			"",
			"\t$0",
			"",
			""
	},
	"description":"Simple HTML5 starting point"
}
6.放入到代码中——>把设定好的代码块——>改名;
{
	// Place your snippets for html 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"
	// }

	"HTML template":{
		"prefix": "hy",
		"body":[
			"",
			"",
			"",
			"\t",
			"\t${1:Page Title}",
			"",
			"",
			"\t$0",
			"",
			""
	},
	"description":"Simple HTML5 starting point"
}
}
***\t——>前面有四个空格
***${1:Page Title}——>代表下一次点光标——>大括号里的内容就闪烁;
7.在其它任何一个.html文件中——>输入“修改好的文件名”+tab——>就会出现以下代码段为"开头代码";



    
    Page Title


    


description

 

 

你可能感兴趣的:(html)