Skip to content

Commit b30d012

Browse files
committed
feat✨(CommitType):commit type的emoji可配置是否显示
1 parent 5ad941a commit b30d012

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/config/commit-type.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { QuickPickItem } from 'vscode';
1+
import { workspace, QuickPickItem } from 'vscode';
22

33
/**
44
* @description git commit 提交类型
55
*/
66
export interface CommitType extends QuickPickItem {}
7-
const CommitType: Array<CommitType> = [
7+
8+
const isShowEmoji = workspace.getConfiguration('showGitCommit').get<boolean>('showEmoji');
9+
10+
let CommitType: Array<CommitType> = [
811
{
912
label: '✨feat',
1013
detail: '添加新特性'
@@ -50,4 +53,13 @@ const CommitType: Array<CommitType> = [
5053
detail: '回滚到上一个版本'
5154
}
5255
];
56+
57+
if (!isShowEmoji) {
58+
CommitType = CommitType.map(commitType => {
59+
const labelArr = [...commitType.label];
60+
labelArr.shift();
61+
commitType.label = labelArr.join('');
62+
return commitType;
63+
});
64+
}
5365
export default CommitType;

0 commit comments

Comments
 (0)