Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 packages/types/src/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const commandIds = [
"focusInput",
"acceptInput",
"focusPanel",
"toggleAutoApprove",
] as const

export type CommandId = (typeof commandIds)[number]
Expand Down
21 changes: 21 additions & 0 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Copy link
Contributor Author

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.

},
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:

  • The toggle functionality works correctly
  • The state is properly updated
  • The webview receives the update
  • The notification is shown

})

export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {
Expand Down
12 changes: 12 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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": [
Expand Down
1 change: 1 addition & 0 deletions src/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"command.terminal.fixCommand.title": "Fix This Command",
"command.terminal.explainCommand.title": "Explain This Command",
"command.acceptInput.title": "Accept Input/Suggestion",
"command.toggleAutoApprove.title": "Toggle Auto-Approve",
"configuration.title": "Roo Code",
"commands.allowedCommands.description": "Commands that can be auto-executed when 'Always approve execute operations' is enabled",
"commands.deniedCommands.description": "Command prefixes that will be automatically denied without asking for approval. In case of conflicts with allowed commands, the longest prefix match takes precedence. Add * to deny all commands.",
Expand Down
Loading