Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

添加少量 snippets,如无不良反馈今后可按需添加 #24

Merged
merged 2 commits into from Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -57,6 +57,10 @@

![演示](截图/演示_TS.png)

同样支持中英混合命名:

![演示](截图/演示_中英混合.png)

## [版本更新说明](CHANGELOG.md)

## 已知问题
Expand Down
12 changes: 11 additions & 1 deletion package.json
Expand Up @@ -42,7 +42,17 @@
"enumDescriptions": []
}
}
}
},
"snippets": [
{
"language": "javascript",
"path": "./片段/javascript.json"
},
{
"language": "python",
"path": "./片段/python.json"
}
]
},
"scripts": {
"test": "node ./test/runTest.js"
Expand Down
4 changes: 4 additions & 0 deletions 供测试/中英混合.js
@@ -0,0 +1,4 @@
function get投入产出比By客户组() {}
function get总投入By客户ID() {}

get投入产出比By客户组()
Binary file added 截图/演示_中英混合.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions 片段/javascript.json
@@ -0,0 +1,14 @@
{
"出现次数": {
"prefix": [
"array",
"ChuXianCiShu",
"出现次数"
],
"body": [
"const 统计出现次数 = (数组, 值) => 数组.reduce((次数, 项) => (项 === 值 ? 次数 + 1 : 次数), 0);",
"统计出现次数(${1:数组}, ${2:值});"
],
"description": "统计数组中某个值出现的次数"
}
}
29 changes: 29 additions & 0 deletions 片段/python.json
@@ -0,0 +1,29 @@
{
"读文件": {
"prefix": [
"file",
"WenJian",
"读文件"
],
"body": [
"with open(${1:文件全路径}) as 文件:",
"\t内容 = 文件.read()"
],
"description": "读取某文件"
},
"读所有文件": {
"prefix": [
"file",
"WenJian",
"读所有文件"
],
"body": [
"import os",
"路径 = '.'",
"for 文件名 in os.listdir(路径):",
"\twith open(os.path.join(路径, 文件名)) as 文件:",
"\t\t内容 = 文件.read()"
],
"description": "读取某目录下所有文件"
}
}