====== VS Code 사용자 snippets 만들기 - html ====== * description : VS Code 사용자 snippets 만들기 - html * author : 오션 * email : shlim@repia.com * lastupdate : 2021-07-15 Thu \\ ===== Snippet ===== 코드 자동 완성 기능\\ ===== HTML ===== VS Code에서 확장자 %%html%%를 가진 파일을 만든 후 첫 라인에 %%!%% (느낌표)를 입력하면,\\ Tab 키 또는 Enter키를 누르면 하기와 같은 기본 %%html%% 서식 문서가 작성됩니다.\\ \\ Document ===== 사용자 snippets 만들기 ===== 1. File > Preferences > User Snippets - 검색창에 %%html.json%%을 입력 후 Enter를 클릭합니다.\\ ( 파일 > 설정 > '사용자 코드 조각' )\\ \\ 2. 기본 저장된 파일의 내용은 하기와 같으며, snippets를 만들기 위한 가이드 내용입니다.\\ (수정 전)\\ { // 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" // } } \\ (수정 후)\\ { "korean html form" : { "prefix": "korean-html-form", "body": [ "", "", "", "", "", "${1:제목을 입력하세요}", "", "", "$2", "", "" ], "description": "html auto-complete for Korean" } } \\ 상기 %%html.json%% 파일을 저장 후, prefix로 지정한 "korean-html-form"을 입력(자동완성이 됩니다)하고\\ Tab 또는 Enter를 클릭하면, 하기와 같이 기본 %%html%% 서식 문서가 생성됩니다.\\ \\ 제목을 입력하세요 \\ %%$1%%, %%$2%%는 자동 완성이 된 후, 옮겨지는 커서의 순서를 가리킵니다.\\ 첫 번째는 title 태그로 커서가 옮겨지고, title 태그에 내용 입력 후 Tab키를 누르면,\\ body안에 있는 %%$2%%의 위치로 커서가 이동합니다.\\ %%html snippet%% 파일 저장 위치 : \\ %%C:\Users\[user name]\AppData\Roaming\Code\User\snippets\ %%\\ ===== Ref ===== [[https://code.visualstudio.com/docs/editor/userdefinedsnippets|Snippets in Visual Studio Code]]\\ \\ [[https://usang0810.tistory.com/29|VSCode HTML 자동완성 만들기(사용자 코드 조각 추가]]\\ \\ [[https://developern.tistory.com/entry/VS-code-user-snippets|VS code 사용자 snippets 만들기]] {{tag>오션, VS Code 사용자 snippets 만들기 - html}}