@@ -5,6 +5,7 @@ import { workspace, QuickPickItem } from 'vscode';
5
5
*/
6
6
export interface CommitType extends QuickPickItem {
7
7
icon ?: string ;
8
+ key ?:string ;
8
9
}
9
10
//是否展现 Emoji图标 show Emoji or not
10
11
const isShowEmoji = workspace . getConfiguration ( 'GitCommitPlugin' ) . get < boolean > ( 'ShowEmoji' ) ;
@@ -14,58 +15,69 @@ const CustomCommitType = workspace.getConfiguration('GitCommitPlugin').get<boole
14
15
let CommitType : Array < CommitType > = [
15
16
{
16
17
label : 'feat' ,
18
+ key : 'feat' ,
17
19
detail : '添加新特性' ,
18
- icon :'✨'
20
+ icon : '✨'
19
21
} ,
20
22
{
21
23
label : 'fix' ,
24
+ key : 'fix' ,
22
25
detail : '修复bug' ,
23
- icon :'🐞'
26
+ icon : '🐞'
24
27
} ,
25
28
{
26
29
label : 'docs' ,
30
+ key : 'docs' ,
27
31
detail : '仅仅修改文档' ,
28
- icon :'📃'
32
+ icon : '📃'
29
33
} ,
30
34
{
31
35
label : 'style' ,
36
+ key : 'style' ,
32
37
detail : '仅仅修改了空格、格式缩进、逗号等等,不改变代码逻辑' ,
33
- icon :'🌈'
38
+ icon : '🌈'
34
39
} ,
35
40
{
36
41
label : 'refactor' ,
42
+ key : 'refactor' ,
37
43
detail : '代码重构,没有加新功能或者修复bug' ,
38
- icon :'🦄'
44
+ icon : '🦄'
39
45
} ,
40
46
{
41
47
label : 'perf' ,
48
+ key : 'perf' ,
42
49
detail : '优化相关,比如提升性能、体验' ,
43
- icon :'🎈'
50
+ icon : '🎈'
44
51
} ,
45
52
{
46
53
label : 'test' ,
54
+ key : 'test' ,
47
55
detail : '增加测试用例' ,
48
- icon :'🧪'
56
+ icon : '🧪'
49
57
} ,
50
58
{
51
59
label : 'build' ,
60
+ key : 'build' ,
52
61
detail : '依赖相关的内容' ,
53
- icon :'🔧'
62
+ icon : '🔧'
54
63
} ,
55
64
{
56
65
label : 'ci' ,
66
+ key : 'ci' ,
57
67
detail : 'ci配置相关 例如对 k8s,docker的配置文件的修改' ,
58
- icon :'🐎'
68
+ icon : '🐎'
59
69
} ,
60
70
{
61
71
label : 'chore' ,
72
+ key : 'chore' ,
62
73
detail : '改变构建流程、或者增加依赖库、工具等' ,
63
- icon :'🐳'
74
+ icon : '🐳'
64
75
} ,
65
76
{
66
77
label : 'revert' ,
78
+ key : 'revert' ,
67
79
detail : '回滚到上一个版本' ,
68
- icon :'↩'
80
+ icon : '↩'
69
81
}
70
82
] ;
71
83
@@ -85,7 +97,7 @@ if (Array.isArray(CustomCommitType)) {
85
97
if ( Reflect . has ( item , 'detail' ) ) { resultType . detail = item . detail ; } else { Reflect . deleteProperty ( resultType , 'detail' ) ; } ;
86
98
if ( Reflect . has ( item , 'icon' ) ) { resultType . icon = item . icon ; } else { Reflect . deleteProperty ( resultType , 'icon' ) ; } ;
87
99
}
88
- const target = CommitType . find ( ( type ) => type . label === item . label ) ;
100
+ const target = CommitType . find ( ( type ) => type . key === item . key ) ;
89
101
90
102
if ( target !== undefined ) {
91
103
Object . assign ( target , resultType ) ;
0 commit comments