기록/정리
[자바스크립트] VS CODE에서 console.log 자동완성하기
코드코코
2021. 10. 29. 11:53
1. 파일 - 기본설정 - 사용자코드 조각
2. 검색창에서 javascript 검색후 클릭하면 javascript.json 파일이 열린다.
3. javascript.json 파일 내용이 전부 주석 처리되어 있다. 이 중 print to console 부분에 해당하는 것 주석 해제.
- prefix : 자동완성으로 나오게 하고싶은 단축어 지정
{
// Place your snippets for javascript 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": "clg",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
4. 이제 js파일에서 clg만 입력하면 console.log(); 가 자동으로 뜬다!