Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"test"
],
"items": {
"type": "string"
"type": ["string", "object"],
"description": "Can be either a string, or an object. If an object, use type for the commit type, and description to give a short description for the particular commit type."
},
"minItems": 1,
"uniqueItems": true,
Expand Down
20 changes: 12 additions & 8 deletions src/commands/semantic-commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class SemanticCommitCommand extends Command {

context: ExtensionContext;
scope: string;
types: string[];
types: (string | {type: string, description: string})[];

constructor(context: ExtensionContext) {
super();
Expand Down Expand Up @@ -110,13 +110,17 @@ export class SemanticCommitCommand extends Command {

private createQuickPickItems(): QuickPickItem[] {
const hasScope = this.hasScope();
const typeItems = this.types.map(type => ({
label: `$(git-commit) Commit with "${type}" type`,
alwaysShow: true,
actionType: ActionType.subject,
type,
description: ''
}));
const typeItems = this.types.map(item => {
const description = typeof item === "string" ? "" : item.description
const type = typeof item === "string" ? item : item.type
return ({
label: `$(git-commit) Commit with "${type}" type`,
alwaysShow: true,
actionType: ActionType.subject,
type,
description
})
});

return [
{
Expand Down