Skip to content

Commit

Permalink
add new snippets: genr and apin
Browse files Browse the repository at this point in the history
suhaotian committed Jan 26, 2025
1 parent d105775 commit 3bdf5aa
Showing 2 changed files with 44 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .vscode/tsdk.code-snippets
Original file line number Diff line number Diff line change
@@ -39,5 +39,25 @@
""
],
"description": "apic onfig snippet"
},
"importApiConf": {
"scope": "typescript",
"prefix": "apin",
"body": [
"${1:name}Config,",
"${1:name}Req,",
"${1:name}Res,",
],
"description": "apic onfig name snippet"
},
"genRoute": {
"scope": "typescript",
"prefix": "genr",
"body": [
"genRoute<${1:name}Req, ${1:name}Res>(${1:name}Config, async (data, reqInfo) => {",
" return ${2://service}(data, reqInfo);",
"});"
],
"description": "genRoute<Req, Res>() snippet"
}
}
27 changes: 24 additions & 3 deletions packages/tsdk/fe-sdk-template/config/.vscode/tsdk.code-snippets
Original file line number Diff line number Diff line change
@@ -22,21 +22,42 @@
" method: '${5|get,post,delete,put,patch,head,options|}',",
" path: transformPath('${2:ApiName}'),",
" description: '${1:description}',",
" category: '${3:Category}',",
" needAuth: true",
" category: '${3:Category}'",
"};",
"/**",
" *",
" * @category ${3:Category}",
" */",
"export type ${2:ApiName}Req = ${8:{\\}};",
"",
"/**",
" *",
" * @category ${3:Category}",
" */",
"export type ${2:ApiName}Res = ${9:{\\}};",
"// --------- ${2:ApiName} END ---------",
""
],
"description": "snippet for API config"
"description": "apic onfig snippet"
},
"importApiConf": {
"scope": "typescript",
"prefix": "apin",
"body": [
"${1:name}Config,",
"${1:name}Req,",
"${1:name}Res,",
],
"description": "apic onfig name snippet"
},
"genRoute": {
"scope": "typescript",
"prefix": "genr",
"body": [
"genRoute<${1:name}Req, ${1:name}Res>(${1:name}Config, async (data, reqInfo) => {",
" return ${2://service}(data, reqInfo);",
"});"
],
"description": "genRoute<Req, Res>() snippet"
}
}

0 comments on commit 3bdf5aa

Please sign in to comment.