-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.code-snippets
147 lines (128 loc) · 2.5 KB
/
global.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
/** Base */
"**": {
"prefix": "**",
"body": ["/** $1 */"],
},
"console.log": {
"prefix": "clg",
"body": ["console.log($1)"],
},
"default":{
"prefix": "df",
"body": ["default"],
},
"deconstruct object": {
"prefix": "cj",
"body": ["const {${2:key}} = ${1:obj}"],
},
"deconstruct array": {
"prefix": "cy",
"body": ["const {${2:first}} = ${1:array}"],
},
"return new Promise": {
"prefix": "np",
"body": ["return new Promise((resolve, reject) => {", "$1", "})"],
},
"try finally": {
"prefix": "tf",
"body": [
"try {",
"\t$1",
"} finally {",
"\t$2",
"}"
],
},
/** Func, Export */
"base function": {
"prefix": "f",
"body": ["($1) => {$2}"],
},
"function": {
"prefix": "fn",
"body": ["function ${1:f}($2) {", "$3", "}"],
},
"arrow function": {
"prefix": "cn",
"body": ["const ${1:f} = ($2) => {", "$3", "}"],
},
"export function": {
"prefix": "efn",
"body": ["export function ${1:f} () {", "$2", "}"],
},
"export arrow function": {
"prefix": "ecn",
"body": ["export const ${1:f} = ($2) => {", "$3", "}"],
},
"export from": {
"prefix": "ex",
"body": [
"export {$2} from '$1'"
],
},
/** Hooks */
"use hooks": {
"prefix": "use",
"body": ["export function ${1:$TM_FILENAME_BASE} () {", "$2", "}"],
},
/** Vue */
"vue-script-setup": {
"scope": "vue",
"prefix": "<sc",
"body": [
"<script setup lang=\"ts\">",
"$1",
"</script>",
"",
"<template>",
" <div>",
" ${2:$TM_FILENAME_BASE}",
" </div>",
"</template>",
]
},
"vue-template": {
"scope": "vue",
"prefix": "vue",
"body": [
"<template>",
" <div>",
" ${2:$TM_FILENAME_BASE}",
" </div>",
"</template>",
"",
"<script setup lang=\"ts\">",
"$1",
"</script>",
"",
"<style lang=\"scss\" scoped>",
"",
"</style>",
""
],
},
"vue-computed": {
"scope": "javascript,typescript,vue",
"prefix": "com",
"body": [
"computed(() => $1)"
]
},
"vue-props": {
"prefix": "props",
"body": [
"const props = defineProps({",
"\t$1",
"})"
],
},
"vue-emit": {
"prefix": "emit",
"body": ["const emit = defineEmits(['$1'])"],
},
"vue-defineOptions": {
"prefix": "dname",
"body": ["defineOptions({ name: '${1:$TM_FILENAME_BASE}' })"]
}
}