Skip to content

Commit e8c2f18

Browse files
committed
2 parents a472737 + cf80a86 commit e8c2f18

8 files changed

Lines changed: 443 additions & 0 deletions

File tree

config/trae/user_rules.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1. 请保持对话语言为中文
2+
2. 我的系统为Windows11

config/vscode/snippets/ahk.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Place your snippets for ahk here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
// "Print to console": {
8+
// "prefix": "log",
9+
// "body": [
10+
// "console.log('$1');",
11+
// "$2"
12+
// ],
13+
// "description": "Log output to console"
14+
// }
15+
}
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
{
2+
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
// "Print to console": {
10+
// "scope": "javascript,typescript",
11+
// "prefix": "log",
12+
// "body": [
13+
// "console.log('$1');",
14+
// "$2"
15+
// ],
16+
// "description": "Log output to console"
17+
// }
18+
"react chrome debug": {
19+
"prefix": "debug-react",
20+
"scope": "json,jsonc",
21+
"body": [
22+
"{",
23+
" \"name\": \"react chrome launch\",",
24+
" \"type\": \"chrome\",",
25+
" \"request\": \"launch\",",
26+
//为了安装插件不与平时使用的chrome冲突,可以使用canary版本,就是chrome的开发者版本,",
27+
//这个版本的更新速度很快,有最新的特性,也有最新的bug",
28+
//\"runtimeExecutable\":\"canary\",
29+
" \"runtimeArgs\": [",
30+
//默认打开chrome开发者面板",
31+
" \"--auto-open-devtools-for-tabs\",",
32+
" ],",
33+
// 设置用户信息保存目录,这样方便安装插件,保存cookie等信息。",
34+
" \"userDataDir\": \"D:\\\\\\chrome-dev-userDataDir\",",
35+
" \"url\": \"http://localhost:${1:3000}\",",
36+
" \"webRoot\": \"\\${workspaceFolder}\"",
37+
"}",
38+
""
39+
],
40+
"description": "react chrome launch debug"
41+
},
42+
"react vite chrome debug": {
43+
"prefix": "debug-react-vite",
44+
"scope": "json,jsonc",
45+
"body": [
46+
"{",
47+
" \"name\": \"react chrome launch\",",
48+
" \"type\": \"chrome\",",
49+
" \"request\": \"launch\",",
50+
//为了安装插件不与平时使用的chrome冲突,可以使用canary版本,就是chrome的开发者版本,",
51+
//这个版本的更新速度很快,有最新的特性,也有最新的bug",
52+
//\"runtimeExecutable\":\"canary\",
53+
" \"runtimeArgs\": [",
54+
//默认打开chrome开发者面板"
55+
" \"--auto-open-devtools-for-tabs\",",
56+
" ],",
57+
// 设置用户信息保存目录,这样方便安装插件,保存cookie等信息。",
58+
" \"userDataDir\": \"D:\\\\\\chrome-dev-userDataDir\",",
59+
" \"url\": \"http://localhost:${1:3000}\",",
60+
// 这个是配置sourcemap映射的目录
61+
// 调试vite项目,webRoot设置一个不存在的目录,是为了热更新的代码断点不会打到本地文件上,因为热更的临时文件并没有本地文件,会导致断点在奇怪的位置
62+
// 配置以后断点就不会断住了
63+
" \"webRoot\": \"\\${workspaceFolder}\"",
64+
"}",
65+
""
66+
],
67+
"description": "react vite chrome launch debug"
68+
},
69+
"vue vite chrome debug": {
70+
"prefix": "debug-vue-vite",
71+
"scope": "json,jsonc",
72+
"body": [
73+
"{",
74+
" \"name\": \"react chrome launch\",",
75+
" \"type\": \"chrome\",",
76+
" \"request\": \"launch\",",
77+
//为了安装插件不与平时使用的chrome冲突,可以使用canary版本,就是chrome的开发者版本,",
78+
//这个版本的更新速度很快,有最新的特性,也有最新的bug",
79+
//\"runtimeExecutable\":\"canary\"
80+
" \"runtimeArgs\": [",
81+
//默认打开chrome开发者面板",
82+
" \"--auto-open-devtools-for-tabs\",",
83+
" ],",
84+
// 设置用户信息保存目录,这样方便安装插件,保存cookie等信息。",
85+
" \"userDataDir\": \"D:\\\\\\chrome-dev-userDataDir\",",
86+
" \"url\": \"http://localhost:${1:3000}\",",
87+
// 这个是配置sourcemap映射的目录
88+
// 调试vite项目,webRoot设置一个不存在的目录,是为了热更新的代码断点不会打到本地文件上,因为热更的临时文件并没有本地文件,会导致断点在奇怪的位置
89+
// 配置以后断点就不会断住了 ${workspaceFolder}\\aaabbb
90+
" \"webRoot\": \"\\${workspaceFolder}\\\\\\aaabbb\"",
91+
"}",
92+
""
93+
],
94+
"description": "vue vite chrome launch debug"
95+
},
96+
// node --inspect-brk 进入调试并在首行断电,可以用chrome devtool调试
97+
"node launch": {
98+
"prefix": "debug-node",
99+
"scope": "json,jsonc",
100+
// "program": "${workspaceFolder}/index.js",
101+
"body": [
102+
"{",
103+
" \"name\": \"node launch\",",
104+
" \"type\": \"node\",",
105+
" \"request\": \"launch\",",
106+
" \"skipFiles\": [",
107+
" \"<node_internals>/**\"",
108+
" ],",
109+
" \"program\": \"\\${workspaceFolder}\\\\\\index.js\"",
110+
// 第一行打断点
111+
// "stopOnEntry": true
112+
"}",
113+
],
114+
"description": "node launch debug"
115+
},
116+
"npm scripts launch": {
117+
"prefix": "debug-npm-scripts",
118+
"scope": "json,jsonc",
119+
"body": [
120+
"{",
121+
" \"name\": \"npm scripts launch\",",
122+
" \"type\": \"node\",",
123+
" \"request\": \"launch\",",
124+
" \"runtimeArgs\": [",
125+
" \"run-script\",",
126+
" \"${1:debug}\"",
127+
" ],",
128+
" \"runtimeExecutable\": \"npm\",",
129+
// 集成到终端和平时开发无缝衔接
130+
// 缺点是 debug console是可以执行表达式获取值的,终端没有这个功能。
131+
" \"console\": \"integratedTerminal\",",
132+
" \"skipFiles\": [",
133+
" \"<node_internals>/**\"",
134+
" ],",
135+
// 第一行打断点
136+
// "stopOnEntry": true
137+
"}",
138+
],
139+
"description": "node launch debug"
140+
},
141+
// 使用特殊变量实现调试当前文件
142+
// 适合调试单个js文件的案例
143+
"node launch current js": {
144+
"prefix": "debug-node-current",
145+
"scope": "json,jsonc",
146+
"body": [
147+
"{",
148+
" \"name\": \"node launch current\",",
149+
" \"type\": \"node\",",
150+
" \"request\": \"launch\",",
151+
" \"skipFiles\": [",
152+
" \"<node_internals>/**\"",
153+
" ],",
154+
// 调试当前的文件
155+
" \"program\": \"\\${file}\"",
156+
"}",
157+
],
158+
"description": "node launch debug"
159+
},
160+
"node launch current ts": {
161+
"prefix": "debug-node-current-ts",
162+
"scope": "json,jsonc",
163+
"body": [
164+
" {",
165+
" \"name\": \"node launch current\",",
166+
" \"type\": \"node\",",
167+
" \"request\": \"launch\",",
168+
" \"skipFiles\": [\"<node_internals>/**\"],",
169+
" \"runtimeExecutable\": \"tsx\",",
170+
" \"console\": \"integratedTerminal\",",
171+
" \"program\": \"\\${file}\"",
172+
" }"
173+
],
174+
"description": "node launch debug"
175+
},
176+
}

config/vscode/snippets/json.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// Place your snippets for json here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
"Create a snippet": {
8+
"prefix": "sn",
9+
"description": "Create a snippet for VSCode",
10+
"body": [
11+
"{",
12+
"\t\"$1\": {",
13+
"\t\t\"prefix\": \"$2\",",
14+
"\t\t\"description\": \"$3\",",
15+
"\t\t\"body\": [",
16+
"\t\t\t$4",
17+
"\t\t]",
18+
"\t}",
19+
"}"
20+
]
21+
}
22+
}

config/vscode/snippets/jsonc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Place your snippets for jsonc here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
// "Print to console": {
8+
// "prefix": "log",
9+
// "body": [
10+
// "console.log('$1');",
11+
// "$2"
12+
// ],
13+
// "description": "Log output to console"
14+
// }
15+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
// Place your snippets for typescript here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
"Print to console": {
8+
"prefix": "print",
9+
"body": ["console.log('$1');", "$2"],
10+
"description": "Log output to console"
11+
},
12+
// antd组件相关的hook
13+
"hook empty": {
14+
"prefix": "he",
15+
"body": [
16+
"export function ${1:useSetupHook}() {",
17+
"$2",
18+
" return {",
19+
" }",
20+
"}",
21+
""
22+
],
23+
"description": "react hook with antd form"
24+
},
25+
// antd组件相关的hook
26+
"hook with form(antd)": {
27+
"prefix": "hf",
28+
"body": [
29+
"import { Form } from 'antd'",
30+
"import { Props } from '.'",
31+
"",
32+
"export function ${1:useSetupHook}(props:Props) {",
33+
" const [form] = Form.useForm()",
34+
" return {",
35+
" form,",
36+
" }",
37+
"}",
38+
""
39+
],
40+
"description": "react hook with antd form"
41+
},
42+
"hook with form reducer(antd)": {
43+
"prefix": "hfr",
44+
"body": [
45+
"import { Form } from 'antd'",
46+
"import { Props } from '.'",
47+
"import {reducer, initialState } from './reducer'",
48+
"import { useReducer } from 'react'",
49+
"",
50+
"export function useSetupHook(props: Props) {",
51+
" const [form] = Form.useForm()",
52+
" const { value } = props",
53+
" const [state, dispatch] = useReducer(reducer, initialState)",
54+
" return {",
55+
" state,",
56+
" form,",
57+
" }",
58+
"}"
59+
],
60+
"description": "react hook with antd form"
61+
},
62+
"handle submit": {
63+
"prefix": "bc",
64+
"body": [
65+
" const ${1:handleSumbit} = async () => {",
66+
" const formValues = await form.validateFields()",
67+
" console.log({ formValues })",
68+
" setIsloading(true)",
69+
" const res = await ${2:SAVE_WORKPLAN}({",
70+
" ...formValues,",
71+
" })",
72+
" if (res.code.startsWith('s')) {",
73+
" message.success('${3:操作成功}')",
74+
" } else {",
75+
" message.error(res.msg)",
76+
" }",
77+
" setIsloading(false)",
78+
" }"
79+
],
80+
"description": "crud add"
81+
},
82+
"for reverse loop": {
83+
"prefix": "forr",
84+
"body": [
85+
"for (let ${1:index} = ${2:array}.length-1; ${1:index} >= 0; ${1:index}--) {",
86+
" const ${3:element} = ${2:array}[${1:index}];",
87+
" ",
88+
"}"
89+
],
90+
"description": "crud add"
91+
}
92+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
// Place your snippets for typescriptreact here. Each snippet is defined under a snippet name and has a prefix, body and
3+
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
4+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
5+
// same ids are connected.
6+
// Example:
7+
// "Print to console": {
8+
// "prefix": "log",
9+
// "body": [
10+
// "console.log('$1');",
11+
// "$2"
12+
// ],
13+
// "description": "Log output to console"
14+
// }
15+
// // antd组件相关的hook
16+
"react component with modal(antd)": {
17+
"prefix": "rfcm",
18+
"body": [
19+
"import React from 'react'",
20+
"import { Modal } from 'antd'",
21+
"import { ModalProps } from 'antd/lib/modal'",
22+
"import { useSetupHook } from './hooks'",
23+
"",
24+
"export interface Props extends ModalProps {}",
25+
"",
26+
"export default function ${1:CustomName}Modal(props: Props) {",
27+
" const { form } = useSetupHook(props)",
28+
" return <Modal title='${2:title}'></Modal>",
29+
"}",
30+
""
31+
],
32+
"description": "react component with modal(antd)"
33+
},
34+
"pageSpy(inspect api)": {
35+
"prefix": "pageSpy",
36+
"body": [
37+
"if (process.env.NODE_ENV === 'development') {",
38+
" const loadPageSpyScript = document.createElement('script')",
39+
" loadPageSpyScript.crossOrigin = 'anonymous'",
40+
" loadPageSpyScript.src = 'http://192.168.21.27:6752/page-spy/index.min.js'",
41+
" loadPageSpyScript.onload = () => {",
42+
" const exeScript = document.createElement('script')",
43+
" exeScript.innerHTML = 'window.$pageSpy = new PageSpy();'",
44+
" document.body.appendChild(exeScript)",
45+
" }",
46+
" document.body.appendChild(loadPageSpyScript)",
47+
"}"
48+
],
49+
"description": "react component with modal(antd)"
50+
}
51+
}

0 commit comments

Comments
 (0)