Skip to content

Commit 230a8bd

Browse files
committed
feat: add snippets for getInitialProps and (fix) use TM_FILENAME_BASE instead of TM_FILENAME
1 parent 8a32bfb commit 230a8bd

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

snippets/next-typescript.code-snippets

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,29 @@
2828
"body": [
2929
"import type { NextPage } from \"next\";",
3030
"",
31-
"const ${1:${TM_FILENAME}}: NextPage = () => {",
31+
"const ${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}}: NextPage = () => {",
3232
" return (",
3333
" <>",
3434
" </>",
3535
" )",
3636
"}",
3737
"",
38-
"export default ${1:${TM_FILENAME}}"
38+
"export default ${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}}"
3939
],
4040
"description": "NextPage component with NextPage type"
4141
},
42+
"nextgip": {
43+
"prefix": "nextgip",
44+
"body": [
45+
"${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}}.getInitialProps = async context => {",
46+
" return {",
47+
" ",
48+
" };",
49+
"};",
50+
""
51+
],
52+
"description": "Get Initial Props in Next.js"
53+
},
4254
"nct": {
4355
"prefix": "nextct",
4456
"body": [

snippets/react-javascript.code-snippets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"rafce": {
33
"prefix": "rafce",
44
"body": [
5-
"const ${1:${TM_FILENAME}}= () => {",
5+
"const ${1:${TM_FILENAME_BASE}}= () => {",
66
" return <div></div>;",
77
"};",
88
"",
9-
"export default ${1:${TM_FILENAME}};",
9+
"export default ${1:${TM_FILENAME_BASE}};",
1010
""
1111
],
1212
"description": "React Functional Component"

snippets/react-typescript.code-snippets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"",
77
"interface Props {}",
88
"",
9-
"const ${1:${TM_FILENAME}}: FC<Props> = () => {",
9+
"const ${1:${TM_FILENAME_BASE}}: FC<Props> = () => {",
1010
" return <div></div>;",
1111
"};",
12-
"export default ${1:${TM_FILENAME}};"
12+
"export default ${1:${TM_FILENAME_BASE}};"
1313
],
1414
"description": "React Functional Component with Types"
1515
}

0 commit comments

Comments
 (0)