Skip to content

Commit 14b931a

Browse files
committed
Bump editor version to 1.812.0 and improve single-file commit message generation flow
1 parent 8512a91 commit 14b931a

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "Free AI coding in chatbots (CWC)",
5-
"version": "1.811.0",
5+
"version": "1.812.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

‎apps/editor/src/commands/generate-commit-message-command/generate-commit-message-command.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,35 @@ export const generate_commit_message_command = (
1818

1919
await repository.status()
2020
const was_empty_stage = (repository.state.indexChanges || []).length == 0
21+
const working_tree_changes = repository.state.workingTreeChanges || []
22+
const is_single_change = was_empty_stage && working_tree_changes.length == 1
2123

2224
const diff = await prepare_staged_changes(repository)
2325

2426
if (!diff) return null
2527

2628
const message_prompt = build_commit_message_prompt(diff)
2729

28-
return { repository, was_empty_stage, message_prompt }
30+
return { repository, was_empty_stage, message_prompt, is_single_change }
2931
}
3032

3133
const run_generate_action = async (
3234
source_control: vscode.SourceControl | undefined,
3335
should_commit: boolean
3436
) => {
3537
let files_staged_by_action = false
38+
let is_single_change_flow = false
3639
const api_providers_manager = new ModelProvidersManager(context)
3740

3841
while (true) {
3942
const data = await get_prompt_data(source_control)
4043
if (!data) return
41-
const { repository, message_prompt } = data
44+
const { repository, message_prompt, is_single_change } = data
4245
let { was_empty_stage } = data
4346

4447
if (was_empty_stage) {
4548
files_staged_by_action = true
49+
is_single_change_flow = is_single_change
4650
} else if (files_staged_by_action) {
4751
was_empty_stage = true
4852
}
@@ -51,13 +55,20 @@ export const generate_commit_message_command = (
5155
await api_providers_manager.get_default_commit_messages_config()
5256
const has_default_config = !!default_config
5357

58+
const show_back_button = was_empty_stage && !is_single_change_flow
59+
5460
const api_config_data = await get_commit_message_config(
5561
context,
56-
was_empty_stage
62+
show_back_button
5763
)
5864

5965
if (api_config_data === 'back') {
6066
if (was_empty_stage) {
67+
if (!show_back_button) {
68+
await vscode.commands.executeCommand('git.unstageAll')
69+
return
70+
}
71+
6172
await vscode.commands.executeCommand('git.unstageAll')
6273
files_staged_by_action = false
6374
continue

0 commit comments

Comments
 (0)