|
9 | 9 | } from './utils' |
10 | 10 | import * as path from 'path' |
11 | 11 | import { execSync } from 'child_process' |
| 12 | +import { handle_accept_commit_message } from '../handle-accept-commit-message' |
12 | 13 |
|
13 | 14 | async function proceed_with_commit_generation( |
14 | 15 | panel_provider: PanelProvider, |
@@ -55,10 +56,30 @@ async function proceed_with_commit_generation( |
55 | 56 | return |
56 | 57 | } |
57 | 58 |
|
58 | | - panel_provider.send_message({ |
59 | | - command: 'SHOW_COMMIT_MESSAGE_MODAL', |
60 | | - commit_message |
61 | | - }) |
| 59 | + const auto_accept_after = vscode.workspace |
| 60 | + .getConfiguration('codeWebChat') |
| 61 | + .get<number>('commitMessageAutoAcceptAfter') |
| 62 | + |
| 63 | + if (auto_accept_after && auto_accept_after > 0) { |
| 64 | + panel_provider.send_message({ |
| 65 | + command: 'SHOW_COMMIT_MESSAGE_MODAL', |
| 66 | + commit_message, |
| 67 | + auto_accept_after_seconds: auto_accept_after |
| 68 | + }) |
| 69 | + } else { |
| 70 | + await handle_accept_commit_message(panel_provider, commit_message) |
| 71 | + panel_provider.send_message({ command: 'COMMIT_PROCESS_CANCELLED' }) |
| 72 | + panel_provider.commit_was_staged_by_script = false |
| 73 | + const commit_message_lines = commit_message.split('\n') |
| 74 | + const shortened_commit_message = commit_message_lines.length |
| 75 | + ? `${commit_message_lines[0]}...` |
| 76 | + : commit_message_lines[0] |
| 77 | + vscode.window.showInformationMessage( |
| 78 | + dictionary.information_message.COMMIT_CREATED_SUCCESSFULLY( |
| 79 | + shortened_commit_message |
| 80 | + ) |
| 81 | + ) |
| 82 | + } |
62 | 83 | } catch (error) { |
63 | 84 | if (panel_provider.commit_was_staged_by_script) { |
64 | 85 | await vscode.commands.executeCommand('git.unstageAll') |
|
0 commit comments