Skip to content

Commit bedbe33

Browse files
committed
Added settings to enable filesChangedManager and display count.
Added settings to enable filesChangedManager and display count.
1 parent cd0f506 commit bedbe33

File tree

14 files changed

+170
-2
lines changed

14 files changed

+170
-2
lines changed

packages/types/src/global-settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export const globalSettingsSchema = z.object({
105105
historyPreviewCollapsed: z.boolean().optional(),
106106
profileThresholds: z.record(z.string(), z.number()).optional(),
107107
hasOpenedModeSelector: z.boolean().optional(),
108+
filesChangedEnabled: z.boolean().optional(),
109+
filesChangedMaxDisplayFiles: z.number().optional(),
108110
})
109111

110112
export type GlobalSettings = z.infer<typeof globalSettingsSchema>

src/core/webview/ClineProvider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,9 @@ export class ClineProvider
16931693
profileThresholds,
16941694
} = await this.getState()
16951695

1696+
const filesChangedEnabled = this.getGlobalState("filesChangedEnabled")
1697+
const filesChangedMaxDisplayFiles = this.getGlobalState("filesChangedMaxDisplayFiles")
1698+
16961699
const telemetryKey = process.env.POSTHOG_API_KEY
16971700
const machineId = vscode.env.machineId
16981701
const mergedAllowedCommands = this.mergeAllowedCommands(allowedCommands)
@@ -1801,6 +1804,8 @@ export class ClineProvider
18011804
profileThresholds: profileThresholds ?? {},
18021805
cloudApiUrl: getRooCodeApiUrl(),
18031806
hasOpenedModeSelector: this.getGlobalState("hasOpenedModeSelector") ?? false,
1807+
filesChangedEnabled: this.getGlobalState("filesChangedEnabled") ?? true,
1808+
filesChangedMaxDisplayFiles: this.getGlobalState("filesChangedMaxDisplayFiles") ?? 50,
18041809
}
18051810
}
18061811

src/core/webview/__tests__/ClineProvider.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ describe("ClineProvider", () => {
539539
sharingEnabled: false,
540540
profileThresholds: {},
541541
hasOpenedModeSelector: false,
542+
filesChangedEnabled: true,
543+
filesChangedMaxDisplayFiles: 50,
542544
}
543545

544546
const message: ExtensionMessage = {

src/core/webview/webviewMessageHandler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,8 @@ export const webviewMessageHandler = async (
961961
...currentState,
962962
customModePrompts: updatedPrompts,
963963
hasOpenedModeSelector: currentState.hasOpenedModeSelector ?? false,
964+
filesChangedEnabled: currentState.filesChangedEnabled ?? true,
965+
filesChangedMaxDisplayFiles: currentState.filesChangedMaxDisplayFiles ?? 50,
964966
}
965967
provider.postMessageToWebview({ type: "state", state: stateWithPrompts })
966968

src/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,18 @@
339339
"type": "string",
340340
"default": "",
341341
"description": "%settings.autoImportSettingsPath.description%"
342+
},
343+
"roo-cline.filesChangedEnabled": {
344+
"type": "boolean",
345+
"default": true,
346+
"description": "%settings.filesChangedEnabled.description%"
347+
},
348+
"roo-cline.filesChangedMaxDisplayFiles": {
349+
"type": "number",
350+
"default": 50,
351+
"minimum": 10,
352+
"maximum": 200,
353+
"description": "%settings.filesChangedMaxDisplayFiles.description%"
342354
}
343355
}
344356
}

src/package.nls.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
"settings.vsCodeLmModelSelector.family.description": "The family of the language model (e.g. gpt-4)",
3333
"settings.customStoragePath.description": "Custom storage path. Leave empty to use the default location. Supports absolute paths (e.g. 'D:\\RooCodeStorage')",
3434
"settings.enableCodeActions.description": "Enable Roo Code quick fixes",
35-
"settings.autoImportSettingsPath.description": "Path to a RooCode configuration file to automatically import on extension startup. Supports absolute paths and paths relative to the home directory (e.g. '~/Documents/roo-code-settings.json'). Leave empty to disable auto-import."
35+
"settings.autoImportSettingsPath.description": "Path to a RooCode configuration file to automatically import on extension startup. Supports absolute paths and paths relative to the home directory (e.g. '~/Documents/roo-code-settings.json'). Leave empty to disable auto-import.",
36+
"settings.filesChangedEnabled.description": "Show an overview of files modified by the AI during conversation",
37+
"settings.filesChangedMaxDisplayFiles.description": "Maximum number of files to display before enabling virtualization for performance (10-200)"
3638
}

src/shared/ExtensionMessage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ export type ExtensionState = Pick<
272272
marketplaceInstalledMetadata?: { project: Record<string, any>; global: Record<string, any> }
273273
profileThresholds: Record<string, number>
274274
hasOpenedModeSelector: boolean
275+
filesChangedEnabled: boolean
276+
filesChangedMaxDisplayFiles: number
275277
}
276278

277279
export interface ClineSayTool {

src/shared/WebviewMessage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export interface WebviewMessage {
180180
| "fetchMarketplaceData"
181181
| "switchTab"
182182
| "shareTaskSuccess"
183+
| "filesChangedEnabled"
184+
| "filesChangedMaxDisplayFiles"
183185
text?: string
184186
tab?: "settings" | "history" | "mcp" | "modes" | "chat" | "marketplace" | "account"
185187
disabled?: boolean

webview-ui/src/components/file-changes/FilesChangedOverview.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react"
22
import { FileChangeset, FileChange } from "@roo-code/types"
33
import { useTranslation } from "react-i18next"
4+
import { useExtensionState } from "@/context/ExtensionStateContext"
45

56
interface FilesChangedOverviewProps {
67
changeset: FileChangeset
@@ -31,11 +32,12 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
3132
onRejectAll,
3233
}) => {
3334
const { t } = useTranslation()
35+
const { filesChangedEnabled, filesChangedMaxDisplayFiles } = useExtensionState()
3436
const files = changeset.files
3537
const [isCollapsed, setIsCollapsed] = React.useState(true)
3638

3739
// Performance optimization: Use virtualization for large file lists
38-
const VIRTUALIZATION_THRESHOLD = 50
40+
const VIRTUALIZATION_THRESHOLD = filesChangedMaxDisplayFiles || 50
3941
const ITEM_HEIGHT = 60 // Approximate height of each file item
4042
const MAX_VISIBLE_ITEMS = 10
4143
const [scrollTop, setScrollTop] = React.useState(0)
@@ -126,6 +128,11 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
126128
return parts.length > 0 ? ` (${parts.join(", ")})` : ""
127129
}, [files])
128130

131+
// Don't render if the feature is disabled
132+
if (!filesChangedEnabled) {
133+
return null
134+
}
135+
129136
return (
130137
<div
131138
className="files-changed-overview"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { HTMLAttributes } from "react"
2+
import { useAppTranslation } from "@/i18n/TranslationContext"
3+
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
4+
import { Monitor } from "lucide-react"
5+
6+
import { SetCachedStateField } from "./types"
7+
import { SectionHeader } from "./SectionHeader"
8+
import { Section } from "./Section"
9+
import { Slider } from "../ui"
10+
import { vscode } from "@/utils/vscode"
11+
12+
type InterfaceSettingsProps = HTMLAttributes<HTMLDivElement> & {
13+
filesChangedEnabled?: boolean
14+
filesChangedMaxDisplayFiles?: number
15+
setCachedStateField: SetCachedStateField<"filesChangedEnabled" | "filesChangedMaxDisplayFiles">
16+
}
17+
18+
export const InterfaceSettings = ({
19+
filesChangedEnabled,
20+
filesChangedMaxDisplayFiles,
21+
setCachedStateField,
22+
...props
23+
}: InterfaceSettingsProps) => {
24+
const { t } = useAppTranslation()
25+
26+
return (
27+
<div {...props}>
28+
<SectionHeader>
29+
<div className="flex items-center gap-2">
30+
<Monitor className="w-4" />
31+
<div>{t("settings:sections.interface")}</div>
32+
</div>
33+
</SectionHeader>
34+
35+
<Section>
36+
{/* Files Changed Settings Section */}
37+
<div>
38+
<div className="flex items-center gap-2 font-bold mb-3">
39+
<span className="codicon codicon-file-diff" />
40+
<div>{t("settings:interface.filesChanged.title")}</div>
41+
</div>
42+
43+
<div>
44+
<VSCodeCheckbox
45+
checked={filesChangedEnabled ?? true}
46+
onChange={(e: any) => {
47+
setCachedStateField("filesChangedEnabled", e.target.checked)
48+
vscode.postMessage({
49+
type: "filesChangedEnabled",
50+
bool: e.target.checked,
51+
})
52+
}}
53+
data-testid="files-changed-enabled-checkbox">
54+
{t("settings:interface.filesChanged.enabled.label")}
55+
</VSCodeCheckbox>
56+
<div className="text-vscode-descriptionForeground text-sm mt-1 mb-3">
57+
{t("settings:interface.filesChanged.enabled.description")}
58+
</div>
59+
</div>
60+
61+
<div>
62+
<span className="block font-medium mb-1">
63+
{t("settings:interface.filesChanged.maxDisplayFiles.label")}
64+
</span>
65+
<div className="flex items-center gap-2">
66+
<Slider
67+
min={10}
68+
max={200}
69+
step={1}
70+
value={[filesChangedMaxDisplayFiles ?? 50]}
71+
onValueChange={([value]) => {
72+
setCachedStateField("filesChangedMaxDisplayFiles", value)
73+
vscode.postMessage({
74+
type: "filesChangedMaxDisplayFiles",
75+
value: value,
76+
})
77+
}}
78+
data-testid="files-changed-max-display-files-slider"
79+
/>
80+
<span className="w-10">{filesChangedMaxDisplayFiles ?? 50}</span>
81+
</div>
82+
<div className="text-vscode-descriptionForeground text-sm mt-1">
83+
{t("settings:interface.filesChanged.maxDisplayFiles.description")}
84+
</div>
85+
</div>
86+
</div>
87+
</Section>
88+
</div>
89+
)
90+
}

0 commit comments

Comments
 (0)