Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(extension): add silentAutoCommit option to not focus scm pane on… #200

Merged
merged 3 commits into from
Dec 17, 2021
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ You can access VSCode Conventional Commits in two ways:
| `conventionalCommits.scopes` | Specify available selections in the `scope` section. | [] |
| `conventionalCommits.showEditor` | Control whether the extension should show the commit message as a text document in a separate tab. | false |
| `conventionalCommits.showNewVersionNotes` | Control whether the extension should show the new version notes. | true |
| `conventionalCommits.silentAutoCommit` | Control that auto commit should be silent, without focusing source control panel. | false |
| `conventionalCommits.editor.keepAfterSave` | Control whether the extension should keep the editor tab open after saving the commit message. | false |

## Commit Workflow
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
"default": true,
"markdownDescription": "%extension.configuration.autoCommit.markdownDescription%"
},
"conventionalCommits.silentAutoCommit": {
"type": "boolean",
"default": false,
"markdownDescription": "%extension.configuration.silentAutoCommit.markdownDescription%"
},
"conventionalCommits.emojiFormat": {
"type": "string",
"default": "code",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"extension.commands.resetGlobalState": "Conventional Commits: Reset Global State",
"extension.commands.showNewVersionNotes": "Conventional Commits: Show Version Notes",
"extension.configuration.autoCommit.markdownDescription": "Control whether the extension should commit files after: forming the message or closing the editor tab.\n\nWhen `#git.enableSmartCommit#` enabled and `#git.smartCommitChanges#` was set to `all`, It allows to commit all changes when there are no staged changes.\n\nAnd set `#git.postCommitCommand#` to `sync` to run `git.sync` after commit.",
"extension.configuration.silentAutoCommit.markdownDescription": "Control that auto commit should be silent, without focusing source control panel.",
"extension.configuration.emojiFormat.markdownDescription": "Specify which format will be shown in the `gitmoji`.",
"extension.configuration.emojiFormat.markdownEnumDescriptions.code": "Display as `:bug:`",
"extension.configuration.emojiFormat.markdownEnumDescriptions.emoji": "Display as `🐛`",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extension.name": "约定式提交",
"extension.commands.resetGlobalState": "约定式提交: 重置全局状态",
"extension.commands.showNewVersionNotes": "约定式提交: 显示版本提示",
"extension.configuration.silentAutoCommit.markdownDescription": "是否需要静默自动提交。\n\n启用后,自动提交后会自动聚焦到源代码控制面板。",
"extension.configuration.autoCommit.markdownDescription": "是否自动提交改动。\n\n当打开 `#git.enableSmartCommit#` 并设置 `#git.smartCommitChanges#` 为 `all` 时,可以在无暂存内容时,自动将所有改动提交。\n\n设置 `#git.postCommitCommand#` 为 `sync` 可以在提交后自动执行 `git.sync`。",
"extension.configuration.emojiFormat.markdownDescription": "指定将在 `gitmoji` 中显示的格式。",
"extension.configuration.emojiFormat.markdownEnumDescriptions.code": "显示为 `:bug:`",
Expand Down
1 change: 1 addition & 0 deletions src/lib/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum EMOJI_FORMAT {

export type Configuration = {
autoCommit: boolean;
silentAutoCommit: boolean;
gitmoji: boolean;
emojiFormat: EMOJI_FORMAT;
showEditor: boolean;
Expand Down
5 changes: 4 additions & 1 deletion src/lib/conventional-commits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ export default function createConventionalCommits() {
// 6. switch to scm and put message into message box
// or show the entire commit message in a separate tab
const showEditor = configuration.get<boolean>('showEditor');
const silentAutoCommit = configuration.get<boolean>('silentAutoCommit');
if (showEditor) {
repository.inputBox.value = message;
await openMessageInTab(repository);
output.info('Show full commit message in a separate tab successfully.');
} else {
vscode.commands.executeCommand('workbench.view.scm');
if (!silentAutoCommit) {
vscode.commands.executeCommand('workbench.view.scm');
}
repository.inputBox.value = message;
output.info(`inputBox.value:\n${repository.inputBox.value}`);
}
Expand Down