Skip to content

Commit 20e2bac

Browse files
committed
✨ Add command gptcommit.disableConventionalCommit (gptcommit 0.5.x)
1 parent 13d49f8 commit 20e2bac

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
{
5151
"command": "gptcommit.showPerFileSummary",
5252
"title": "GPTCommit: Show per-file summary"
53+
},
54+
{
55+
"command": "gptcommit.disableConventionalCommit",
56+
"title": "GPTCommit: Disable conventional commit"
5357
}
5458
],
5559
"menus": {

src/commands/createCommandConfigs.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function setupOpenAIApiKey(context: vscode.ExtensionContext, channel: vsc
1515
channel,
1616
getRepo(uri),
1717
key,
18-
'OpenAI API key saved'
18+
'Configuration openai.api_key saved'
1919
);
2020
}
2121
});
@@ -38,7 +38,7 @@ export function useDifferentModel(context: vscode.ExtensionContext, channel: vsc
3838
channel,
3939
getRepo(uri),
4040
model,
41-
'Model saved'
41+
'Configuration openai.model saved'
4242
);
4343
}
4444
});
@@ -61,7 +61,7 @@ export function setOutputLanguage(context: vscode.ExtensionContext, channel: vsc
6161
channel,
6262
getRepo(uri),
6363
lang,
64-
'Output language saved'
64+
'Configuration output.lang saved'
6565
);
6666
}
6767
});
@@ -76,7 +76,6 @@ export function showPerFileSummary(context: vscode.ExtensionContext, channel: vs
7676
["Yes", "No"],
7777
{
7878
placeHolder: 'Enable "show per-file summary"?',
79-
ignoreFocusOut: true,
8079
}
8180
).then((show) => {
8281
if (show === "Yes" || show === "No") {
@@ -86,11 +85,35 @@ export function showPerFileSummary(context: vscode.ExtensionContext, channel: vs
8685
channel,
8786
getRepo(uri),
8887
show === "Yes" ? "true" : "false",
89-
'Configuration show per-file summary saved'
88+
'Configuration output.show_per_file_summary saved'
9089
);
9190
}
9291
});
9392
});
9493

9594
context.subscriptions.push(showPerFileCommand);
9695
}
96+
97+
export function disableConventionalCommit(context: vscode.ExtensionContext, channel: vscode.OutputChannel) {
98+
let disableConvCommitCommand = vscode.commands.registerCommand('gptcommit.disableConventionalCommit', async (uri?: vscode.SourceControl) => {
99+
vscode.window.showQuickPick(
100+
["Yes", "No"],
101+
{
102+
placeHolder: 'Disable conventional commit?',
103+
}
104+
).then((show) => {
105+
if (show === "Yes" || show === "No") {
106+
saveConfig(
107+
'output.conventional_commit',
108+
'output.conventional_commit',
109+
channel,
110+
getRepo(uri),
111+
show === "Yes" ? "false" : "true",
112+
'Configuration output.conventional_commit saved'
113+
);
114+
}
115+
});
116+
});
117+
118+
context.subscriptions.push(disableConvCommitCommand);
119+
}

src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
useDifferentModel,
88
setOutputLanguage,
99
showPerFileSummary,
10+
disableConventionalCommit,
1011
} from './commands/createCommandConfigs';
1112

1213
// This method is called when your extension is activated
@@ -28,6 +29,7 @@ export function activate(context: vscode.ExtensionContext) {
2829
useDifferentModel(context, channel);
2930
setOutputLanguage(context, channel);
3031
showPerFileSummary(context, channel);
32+
disableConventionalCommit(context, channel);
3133
}
3234

3335
// This method is called when your extension is deactivated

0 commit comments

Comments
 (0)