|
1 | 1 | import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" |
2 | | -import { useCallback, useMemo, useState } from "react" |
| 2 | +import { useCallback, useState } from "react" |
3 | 3 | import { Trans } from "react-i18next" |
4 | 4 | import { VSCodeLink } from "@vscode/webview-ui-toolkit/react" |
5 | 5 |
|
@@ -56,69 +56,56 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { |
56 | 56 |
|
57 | 57 | const { t } = useAppTranslation() |
58 | 58 |
|
59 | | - const actions: AutoApproveAction[] = useMemo( |
60 | | - () => [ |
61 | | - { |
62 | | - id: "readFiles", |
63 | | - label: t("chat:autoApprove.actions.readFiles.label"), |
64 | | - enabled: alwaysAllowReadOnly ?? false, |
65 | | - description: t("chat:autoApprove.actions.readFiles.description"), |
66 | | - }, |
67 | | - { |
68 | | - id: "editFiles", |
69 | | - label: t("chat:autoApprove.actions.editFiles.label"), |
70 | | - enabled: alwaysAllowWrite ?? false, |
71 | | - description: t("chat:autoApprove.actions.editFiles.description"), |
72 | | - }, |
73 | | - { |
74 | | - id: "executeCommands", |
75 | | - label: t("chat:autoApprove.actions.executeCommands.label"), |
76 | | - enabled: alwaysAllowExecute ?? false, |
77 | | - description: t("chat:autoApprove.actions.executeCommands.description"), |
78 | | - }, |
79 | | - { |
80 | | - id: "useBrowser", |
81 | | - label: t("chat:autoApprove.actions.useBrowser.label"), |
82 | | - enabled: alwaysAllowBrowser ?? false, |
83 | | - description: t("chat:autoApprove.actions.useBrowser.description"), |
84 | | - }, |
85 | | - { |
86 | | - id: "useMcp", |
87 | | - label: t("chat:autoApprove.actions.useMcp.label"), |
88 | | - enabled: alwaysAllowMcp ?? false, |
89 | | - description: t("chat:autoApprove.actions.useMcp.description"), |
90 | | - }, |
91 | | - { |
92 | | - id: "switchModes", |
93 | | - label: t("chat:autoApprove.actions.switchModes.label"), |
94 | | - enabled: alwaysAllowModeSwitch ?? false, |
95 | | - description: t("chat:autoApprove.actions.switchModes.description"), |
96 | | - }, |
97 | | - { |
98 | | - id: "subtasks", |
99 | | - label: t("chat:autoApprove.actions.subtasks.label"), |
100 | | - enabled: alwaysAllowSubtasks ?? false, |
101 | | - description: t("chat:autoApprove.actions.subtasks.description"), |
102 | | - }, |
103 | | - { |
104 | | - id: "retryRequests", |
105 | | - label: t("chat:autoApprove.actions.retryRequests.label"), |
106 | | - enabled: alwaysApproveResubmit ?? false, |
107 | | - description: t("chat:autoApprove.actions.retryRequests.description"), |
108 | | - }, |
109 | | - ], |
110 | | - [ |
111 | | - alwaysAllowReadOnly, |
112 | | - alwaysAllowWrite, |
113 | | - alwaysAllowExecute, |
114 | | - alwaysAllowBrowser, |
115 | | - alwaysAllowMcp, |
116 | | - alwaysAllowModeSwitch, |
117 | | - alwaysAllowSubtasks, |
118 | | - alwaysApproveResubmit, |
119 | | - t, |
120 | | - ], |
121 | | - ) |
| 59 | + const actions: AutoApproveAction[] = [ |
| 60 | + { |
| 61 | + id: "readFiles", |
| 62 | + label: t("chat:autoApprove.actions.readFiles.label"), |
| 63 | + enabled: alwaysAllowReadOnly ?? false, |
| 64 | + description: t("chat:autoApprove.actions.readFiles.description"), |
| 65 | + }, |
| 66 | + { |
| 67 | + id: "editFiles", |
| 68 | + label: t("chat:autoApprove.actions.editFiles.label"), |
| 69 | + enabled: alwaysAllowWrite ?? false, |
| 70 | + description: t("chat:autoApprove.actions.editFiles.description"), |
| 71 | + }, |
| 72 | + { |
| 73 | + id: "executeCommands", |
| 74 | + label: t("chat:autoApprove.actions.executeCommands.label"), |
| 75 | + enabled: alwaysAllowExecute ?? false, |
| 76 | + description: t("chat:autoApprove.actions.executeCommands.description"), |
| 77 | + }, |
| 78 | + { |
| 79 | + id: "useBrowser", |
| 80 | + label: t("chat:autoApprove.actions.useBrowser.label"), |
| 81 | + enabled: alwaysAllowBrowser ?? false, |
| 82 | + description: t("chat:autoApprove.actions.useBrowser.description"), |
| 83 | + }, |
| 84 | + { |
| 85 | + id: "useMcp", |
| 86 | + label: t("chat:autoApprove.actions.useMcp.label"), |
| 87 | + enabled: alwaysAllowMcp ?? false, |
| 88 | + description: t("chat:autoApprove.actions.useMcp.description"), |
| 89 | + }, |
| 90 | + { |
| 91 | + id: "switchModes", |
| 92 | + label: t("chat:autoApprove.actions.switchModes.label"), |
| 93 | + enabled: alwaysAllowModeSwitch ?? false, |
| 94 | + description: t("chat:autoApprove.actions.switchModes.description"), |
| 95 | + }, |
| 96 | + { |
| 97 | + id: "subtasks", |
| 98 | + label: t("chat:autoApprove.actions.subtasks.label"), |
| 99 | + enabled: alwaysAllowSubtasks ?? false, |
| 100 | + description: t("chat:autoApprove.actions.subtasks.description"), |
| 101 | + }, |
| 102 | + { |
| 103 | + id: "retryRequests", |
| 104 | + label: t("chat:autoApprove.actions.retryRequests.label"), |
| 105 | + enabled: alwaysApproveResubmit ?? false, |
| 106 | + description: t("chat:autoApprove.actions.retryRequests.description"), |
| 107 | + }, |
| 108 | + ] |
122 | 109 |
|
123 | 110 | const toggleExpanded = useCallback(() => { |
124 | 111 | setIsExpanded((prev) => !prev) |
|
0 commit comments