-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add global command to toggle Auto-Approve with keybinding #8073
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,6 +221,27 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt | |
|
|
||
| visibleProvider.postMessageToWebview({ type: "acceptInput" }) | ||
| }, | ||
| toggleAutoApprove: async () => { | ||
| const visibleProvider = getVisibleProviderOrLog(outputChannel) | ||
|
|
||
| if (!visibleProvider) { | ||
| return | ||
| } | ||
|
|
||
| // Get current state using context proxy | ||
| const currentState = visibleProvider.contextProxy.getValue("autoApprovalEnabled") ?? false | ||
|
|
||
| // Toggle the state | ||
| const newState = !currentState | ||
| await visibleProvider.contextProxy.setValue("autoApprovalEnabled", newState) | ||
|
|
||
| // Update the webview | ||
| await visibleProvider.postStateToWebview() | ||
|
|
||
| // Show notification to user | ||
| const statusText = newState ? "enabled" : "disabled" | ||
| vscode.window.showInformationMessage(`Auto-Approve ${statusText}`) | ||
| }, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing unit tests for the new toggleAutoApprove command. Would be good to add tests similar to the existing getVisibleProviderOrLog tests to verify:
|
||
| }) | ||
|
|
||
| export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,6 +174,11 @@ | |
| "command": "roo-cline.acceptInput", | ||
| "title": "%command.acceptInput.title%", | ||
| "category": "%configuration.title%" | ||
| }, | ||
| { | ||
| "command": "roo-cline.toggleAutoApprove", | ||
| "title": "%command.toggleAutoApprove.title%", | ||
| "category": "%configuration.title%" | ||
| } | ||
| ], | ||
| "menus": { | ||
|
|
@@ -310,6 +315,13 @@ | |
| "win": "ctrl+y", | ||
| "linux": "ctrl+y", | ||
| "when": "editorTextFocus && editorHasSelection" | ||
| }, | ||
| { | ||
| "command": "roo-cline.toggleAutoApprove", | ||
| "key": "ctrl+shift+a", | ||
| "mac": "cmd+shift+a", | ||
| "win": "ctrl+shift+a", | ||
| "linux": "ctrl+shift+a" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The keybinding Ctrl+Shift+A (Cmd+Shift+A on Mac) might conflict with other extensions or VS Code defaults. While this works, consider documenting this in the README or checking for potential conflicts with common extensions. |
||
| } | ||
| ], | ||
| "submenus": [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notification message should be internationalized. Consider using:
This would require adding the corresponding keys to the localization files.