자바스크립트 문법

vscode: html 자동 완성 수정

자무카 2022. 11. 6.

! 누르면,  완성되는 html 이 불필요한게 많아서... 이렇게 되길 원함.

html-ko 를 누르면 이렇게 나오면 좋겠다.

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link href="style.css">
</head>
<body>

</body>
</html>

 

방법

기본설정->사용자 코드 조각(code snippet)->html

    참고로 $1, $2, $3… 는 커서의 위치를 지정하는것으로 $1에 최초 커서가 위치하게 되며

    Tab 을 누를 경우 $2 로 바로 이동하게 된다.

   

{
	// 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-ko" : {
        "scope": "html",
        "prefix": "html-ko",
        "body": [
            "<!DOCTYPE html>",
            "<html lang=\"ko\">",
            "<head>",
            	"<meta charset=\"UTF-8\">",
            	"<title>$1</title>",
				"<link rel=\"stylesheet\" href=\"style.css\">",
            "</head>",
            "<body>",
            	"$2",
            	"<script src=\"main.js\"></script>",
            "</body>",
            "</html>"
        ],
        "description": "lang korean 자동코드"
    }
}

 

댓글