1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ちょっとだけ効率を上げる .code-snippets

Posted at

Snippetsの基本 : Snippets in Visual Studio Code

annotation

foo.code-snippets
{
	"annotation:comment:line": {
		"prefix": [
			"todo:line",
			"fixme:line",
			"hack:line",
			"idea:line",
			"nb:line",
			"xxx:line",
			"review:line",
			"bug:line",
			"question:line",
			"combak:line",
			"temp:line",
			"debug:line",
			"optimize:line",
			"changed:line",
			"note:line",
			"warning:line"
		],
		"body": "$LINE_COMMENT ${1|TODO,FIXME,HACK,IDEA,NB,XXX,REVIEW,BUG,QUESTION,COMBAK,TEMP,DEBUG,OPTIMIZE,CHANGED,NOTE,WARNING|}: ${CURRENT_YEAR:YYYY}-${CURRENT_MONTH:MM}-${CURRENT_DATE:DD} ${CURRENT_HOUR:HH}:${CURRENT_MINUTE:MM}:${CURRENT_SECOND:SS} : ${2:author}: ${3:detail}"
	},
	"annotation:comment:block": {
		"prefix": [
			"todo:block",
			"fixme:block",
			"hack:block",
			"idea:block",
			"nb:block",
			"xxx:block",
			"review:block",
			"bug:block",
			"question:block",
			"combak:block",
			"temp:block",
			"debug:block",
			"optimize:block",
			"changed:block",
			"note:block",
			"warning:block"
		],
		"body": "$BLOCK_COMMENT_START ${1|TODO,FIXME,HACK,IDEA,NB,XXX,REVIEW,BUG,QUESTION,COMBAK,TEMP,DEBUG,OPTIMIZE,CHANGED,NOTE,WARNING|}: ${CURRENT_YEAR:YYYY}-${CURRENT_MONTH:MM}-${CURRENT_DATE:DD} ${CURRENT_HOUR:HH}:${CURRENT_MINUTE:MM}:${CURRENT_SECOND:SS} : ${2:author}: ${3:detail} $BLOCK_COMMENT_END"
	},
	"diff": {
		"prefix": "diff",
		"body": [
			"<<<<<<<",
			"$TM_SELECTED_TEXT",
			"=======",
			"$CLIPBOARD",
			">>>>>>>"
		]
	}
}

js

{
	"const": {
		"prefix": "const:fn",
		"scope": "javascript",
		"body": "const ${1:name} = $0"
	},
	"fn:0": {
		"prefix": "fn:0",
		"scope": "javascript",
		"body": "() => $0"
	},
	"fn:1": {
		"prefix": "fn:1",
		"scope": "javascript",
		"body": "${1:arg} => $0"
	},
	"fn:2": {
		"prefix": "fn:2",
		"scope": "javascript",
		"body": "(${1:arg}, ${2:arg}) => $0"
	},
	"fn:gen": {
		"prefix": "fn:gen",
		"scope": "javascript",
		"body": "function* () { yield $0 }"
	},
	"reduce:map:liner": {
		"prefix": "reduce:map:liner",
		"scope": "javascript",
		"body": "${1:arr}.reduce((${2:map}, ${3:val}) => ($2.set($3)$0 ,$2), new Map());"
	},
	"reduce:set:liner": {
		"prefix": "reduce:set:liner",
		"scope": "javascript",
		"body": "${1:arr}.reduce((${2:set}, ${3:val}) => ($2.add($3)$0 ,$2), new Set());"
	},
	"reduce:arr:liner": {
		"prefix": "reduce:arr:liner",
		"scope": "javascript",
		"body": "${1:arr}.reduce((${2:arr}, ${3:val}) => ($2$0 ,$2), []);"
	},
	"reduce:obj:liner": {
		"prefix": "reduce:obj:liner",
		"scope": "javascript",
		"body": "${1:arr}.reduce((${2:obj}, ${3:val}) => ($2$0 ,$2), {});"
	},
	"map:liner": {
		"prefix": "map:liner",
		"scope": "javascript",
		"body": "${1:arr}.map(${2:val} => $2$0);"
	},
	"for:liner": {
		"prefix": "forEaach:liner",
		"scope": "javascript",
		"body": "${1:arr}.forEaach(${2:val} => $2$0);"
	},
	"reduce:map:block": {
		"prefix": "reduce:map:liner",
		"scope": "javascript",
		"body": [
			"${1:arr}.reduce((${2:map}, ${3:val}) => {",
			"\t$2.set($3)$0",
			"\treturn $2;",
			"}, new Map());"
		]
	},
	"reduce:set:block": {
		"prefix": "reduce:set:block",
		"scope": "javascript",
		"body": [
			"${1:arr}.reduce((${2:set}, ${3:val}) => {",
			"\t$2.add($3)$0",
			"\treturn $2;",
			"}, new Set());"
		]
	},
	"reduce:arr:block": {
		"prefix": "reduce:arr:block",
		"scope": "javascript",
		"body": [
			"${1:arr}.reduce((${2:arr}, ${3:val}) => {",
			"\t$2$0",
			"\treturn $2;",
			"}, []);"
		]
	},
	"reduce:obj:block": {
		"prefix": "reduce:obj:block",
		"scope": "javascript",
		"body": [
			"${1:arr}.reduce((${2:obj}, ${3:val}) => {",
			"\t$2$0",
			"\treturn $2;",
			"}, {});"
		]
	},
	"map:block": {
		"prefix": "reduce:obj:block",
		"scope": "javascript",
		"body": [
			"${1:arr}.map(${2:val} => {",
			"\treturn $2$0",
			"}, {});"
		]
	},
	"forEach:block": {
		"prefix": "reduce:obj:block",
		"scope": "javascript",
		"body": [
			"${1:arr}.forEaach(${2:val} => {",
			"\treturn $2$0",
			"}, {});"
		]
	},
	"distinct": {
		"prefix": "distinct",
		"scope": "javascript",
		"body": "${1:arr}.filter((v, i, a) => v.indexOf(v) === i)$0"
	},
	"createelement": {
		"prefix": "createElement",
		"scope": "javascript",
		"body": "document.createElement(`${1:tag}`)$0"
	},
	"queryselct": {
		"prefix": "querySelector",
		"scope": "javascript",
		"body": "document.querySelector(`${1:q}`)$0"
	},
	"queryselctall": {
		"prefix": "querySelectorAll",
		"scope": "javascript",
		"body": "document.querySelectorAll(`${1:q}`)$0"
	},
	"it?then:else": {
		"prefix": "if?then:else",
		"scope": "javascript",
		"body": [
			"${1:condition}",
			"\t? ${2:then}",
			"\t: ${3:else}$0"
		]
	},
	"obj_key_val": {
		"prefix": "obj:key:val",
		"scope": "javascript",
		"body": "${1:key}: ${2:val},$0"
	},
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?