Skip to content

Commit 91dc347

Browse files
committed
✨ Disable generation command while generating messages
1 parent a21da95 commit 91dc347

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
{
3333
"command": "gptcommit.generateGitCommitMessage",
3434
"title": "GPTCommit: Generate Git Commit Message",
35-
"icon": "$(output)"
35+
"icon": "$(output)",
36+
"enablement": "!gptcommit.generating"
3637
},
3738
{
3839
"command": "gptcommit.setupOpenAIApiKey",

src/commands/createCommandGenerateGitCommitMessage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ export default (context: vscode.ExtensionContext, channel: vscode.OutputChannel)
1212
}
1313

1414
const config = vscode.workspace.getConfiguration('gptcommit');
15-
15+
vscode.commands.executeCommand('setContext', 'gptcommit.generating', true);
1616
getCommitMessage(config, repo, context, channel).then((message) => {
1717
if (repo) {
1818
repo.inputBox.value = message;
1919
}
20+
vscode.commands.executeCommand('setContext', 'gptcommit.generating', false);
2021
}).catch((err) => {
2122
vscode.window.showErrorMessage(err);
23+
vscode.commands.executeCommand('setContext', 'gptcommit.generating', false);
2224
});
2325
}
2426
);

0 commit comments

Comments
 (0)