Skip to content

Commit 2f9b748

Browse files
Apply suggestions from code review
Co-authored-by: Daniel <[email protected]>
1 parent b7a3220 commit 2f9b748

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

src/core/webview/webviewMessageHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
6868
await updateGlobalState("autoCloseRooTabs", autoCloseRooTabs)
6969
await provider.postStateToWebview()
7070
break
71-
case "autoCloseAllRooTabs": // Added new setting
71+
case "autoCloseAllRooTabs":
7272
const autoCloseAllRooTabs = message.bool ?? false
7373
await provider.context.globalState.update("autoCloseAllRooTabs", autoCloseAllRooTabs)
7474
// Also update workspace settings

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export type ExtensionState = Pick<
167167
| "diffEnabled"
168168
| "diffViewAutoFocus"
169169
| "autoCloseRooTabs"
170-
| "autoCloseAllRooTabs" // Added new setting
170+
| "autoCloseAllRooTabs"
171171
| "fuzzyMatchThreshold"
172172
// | "experiments" // Optional in GlobalSettings, required here.
173173
| "language"

src/shared/WebviewMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface WebviewMessage {
1414
type:
1515
| "diffViewAutoFocus"
1616
| "autoCloseRooTabs"
17-
| "autoCloseAllRooTabs" // Added new setting
17+
| "autoCloseAllRooTabs"
1818
| "apiConfiguration"
1919
| "deleteMultipleTasksWithIds"
2020
| "currentApiConfigName"

webview-ui/src/components/settings/DiffSettingsControl.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ interface DiffCheckAutoCloseControlProps {
3030
}
3131

3232
interface DiffCheckAutoCloseAllControlProps {
33-
// Added new component interface
3433
autoCloseAllRooTabs: boolean
35-
disabled: boolean // Added disabled prop
34+
disabled: boolean
3635
onChange: (e: any) => void
3736
}
3837

@@ -74,7 +73,6 @@ const DiffViewAutoCloseAllControl: React.FC<DiffCheckAutoCloseAllControlProps> =
7473
disabled,
7574
onChange,
7675
}) => {
77-
// Added new component
7876
const { t } = useAppTranslation()
7977
return (
8078
<div>
@@ -119,7 +117,7 @@ export const DiffSettingsControl: React.FC<DiffSettingsControlProps> = ({
119117
diffEnabled = true,
120118
diffViewAutoFocus = true,
121119
autoCloseRooTabs = false,
122-
autoCloseAllRooTabs = false, // Added new setting
120+
autoCloseAllRooTabs = false,
123121
fuzzyMatchThreshold = 1.0,
124122
onChange,
125123
}) => {
@@ -158,7 +156,6 @@ export const DiffSettingsControl: React.FC<DiffSettingsControlProps> = ({
158156
)
159157

160158
const handleAutoCloseAllRooTabsChange = useCallback(
161-
// Added new handler
162159
(e: any) => {
163160
onChange("autoCloseAllRooTabs", e.target.checked)
164161
},
@@ -190,7 +187,7 @@ export const DiffSettingsControl: React.FC<DiffSettingsControlProps> = ({
190187
autoCloseRooTabs={autoCloseRooTabs}
191188
onChange={handleAutoCloseRooTabsChange}
192189
/>
193-
<DiffViewAutoCloseAllControl // Added new component
190+
<DiffViewAutoCloseAllControl
194191
autoCloseAllRooTabs={autoCloseAllRooTabs}
195192
disabled={!autoCloseRooTabs} // Disabled if autoCloseRooTabs is false
196193
onChange={handleAutoCloseAllRooTabsChange}

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
139139
enableCheckpoints,
140140
diffViewAutoFocus,
141141
autoCloseRooTabs,
142-
autoCloseAllRooTabs, // Added new setting
142+
autoCloseAllRooTabs,
143143
diffEnabled,
144144
experiments,
145145
fuzzyMatchThreshold,
@@ -288,7 +288,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
288288
vscode.postMessage({ type: "diffEnabled", bool: diffEnabled })
289289
vscode.postMessage({ type: "diffViewAutoFocus", bool: diffViewAutoFocus })
290290
vscode.postMessage({ type: "autoCloseRooTabs", bool: autoCloseRooTabs })
291-
vscode.postMessage({ type: "autoCloseAllRooTabs", bool: autoCloseAllRooTabs }) // Send new setting
291+
vscode.postMessage({ type: "autoCloseAllRooTabs", bool: autoCloseAllRooTabs })
292292
vscode.postMessage({ type: "enableCheckpoints", bool: enableCheckpoints })
293293
vscode.postMessage({ type: "browserViewportSize", text: browserViewportSize })
294294
vscode.postMessage({ type: "remoteBrowserHost", text: remoteBrowserHost })

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface ExtensionStateContextType extends ExtensionState {
7070
setDiffEnabled: (value: boolean) => void
7171
setDiffViewAutoFocus: (value: boolean) => void
7272
setAutoCloseRooTabs: (value: boolean) => void
73-
setAutoCloseAllRooTabs: (value: boolean) => void // Added new setter
73+
setAutoCloseAllRooTabs: (value: boolean) => void
7474
setEnableCheckpoints: (value: boolean) => void
7575
setBrowserViewportSize: (value: string) => void
7676
setFuzzyMatchThreshold: (value: number) => void

0 commit comments

Comments
 (0)