Skip to content

Commit 530c5c4

Browse files
hannesrudolphclaude
andcommitted
feat: move disableDiffVisualization to experimental settings
- Moved disableDiffVisualization from global settings to experimental settings - Updated all references to access it through experiments instead - Fixed test cases to include the new experiment - Updated translations to reflect experimental nature - Setting now properly affects ALL edit tools (write_to_file, apply_diff, insert_content, search_and_replace) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9e5c504 commit 530c5c4

File tree

15 files changed

+30
-63
lines changed

15 files changed

+30
-63
lines changed

.changeset/disable-diff-visualization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"roo-cline": patch
33
---
44

5-
Add setting to disable diff visualization to prevent LSP crashes
5+
Add experimental setting to disable diff visualization for all edit tools
66

7-
Added a new setting `disableDiffVisualization` that allows users to disable the diff view when editing files. When enabled, files will open directly in the editor instead of showing a side-by-side diff view. This helps prevent Language Server Protocol (LSP) crashes that can occur with very large files, particularly affecting C# developers. The changes made by Roo are still visible in the chat window.
7+
Added a new experimental setting `disableDiffVisualization` that allows users to disable diff visualization for all edit tools (write_to_file, apply_diff, insert_content, search_and_replace). When enabled, files will open directly in the editor instead of showing a side-by-side diff view. This helps prevent Language Server Protocol (LSP) crashes that can occur with very large files, particularly affecting C# developers. The changes made by Roo are still visible in the chat window.

packages/types/src/experiment.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = ["powerSteering", "disableCompletionCommand", "marketplace", "multiFileApplyDiff"] as const
9+
export const experimentIds = [
10+
"powerSteering",
11+
"disableCompletionCommand",
12+
"marketplace",
13+
"multiFileApplyDiff",
14+
"disableDiffVisualization",
15+
] as const
1016

1117
export const experimentIdsSchema = z.enum(experimentIds)
1218

@@ -21,6 +27,7 @@ export const experimentsSchema = z.object({
2127
disableCompletionCommand: z.boolean().optional(),
2228
marketplace: z.boolean().optional(),
2329
multiFileApplyDiff: z.boolean().optional(),
30+
disableDiffVisualization: z.boolean().optional(),
2431
})
2532

2633
export type Experiments = z.infer<typeof experimentsSchema>

packages/types/src/global-settings.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const globalSettingsSchema = z.object({
8383

8484
rateLimitSeconds: z.number().optional(),
8585
diffEnabled: z.boolean().optional(),
86-
disableDiffVisualization: z.boolean().optional(),
8786
fuzzyMatchThreshold: z.number().optional(),
8887
experiments: experimentsSchema.optional(),
8988

@@ -212,7 +211,6 @@ export const EVALS_SETTINGS: RooCodeSettings = {
212211
terminalShellIntegrationDisabled: true,
213212

214213
diffEnabled: true,
215-
disableDiffVisualization: false,
216214
fuzzyMatchThreshold: 1,
217215

218216
enableCheckpoints: false,

src/core/webview/ClineProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,13 @@ export class ClineProvider
529529
apiConfiguration,
530530
organizationAllowList,
531531
diffEnabled: enableDiff,
532-
disableDiffVisualization,
533532
enableCheckpoints,
534533
fuzzyMatchThreshold,
535534
experiments,
536535
} = await this.getState()
537536

537+
const disableDiffVisualization = experiments.disableDiffVisualization ?? false
538+
538539
if (!ProfileValidator.isProfileAllowed(apiConfiguration, organizationAllowList)) {
539540
throw new OrganizationAllowListViolationError(t("common:errors.violated_organization_allowlist"))
540541
}
@@ -571,12 +572,13 @@ export class ClineProvider
571572
const {
572573
apiConfiguration,
573574
diffEnabled: enableDiff,
574-
disableDiffVisualization,
575575
enableCheckpoints,
576576
fuzzyMatchThreshold,
577577
experiments,
578578
} = await this.getState()
579579

580+
const disableDiffVisualization = experiments.disableDiffVisualization ?? false
581+
580582
const cline = new Task({
581583
provider: this,
582584
apiConfiguration,
@@ -1550,7 +1552,6 @@ export class ClineProvider
15501552
ttsEnabled: stateValues.ttsEnabled ?? false,
15511553
ttsSpeed: stateValues.ttsSpeed ?? 1.0,
15521554
diffEnabled: stateValues.diffEnabled ?? true,
1553-
disableDiffVisualization: stateValues.disableDiffVisualization ?? false,
15541555
enableCheckpoints: stateValues.enableCheckpoints ?? true,
15551556
soundVolume: stateValues.soundVolume,
15561557
browserViewportSize: stateValues.browserViewportSize ?? "900x600",

src/core/webview/webviewMessageHandler.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,6 @@ export const webviewMessageHandler = async (
645645
await updateGlobalState("diffEnabled", diffEnabled)
646646
await provider.postStateToWebview()
647647
break
648-
case "disableDiffVisualization":
649-
const disableDiffVisualization = message.bool ?? false
650-
await updateGlobalState("disableDiffVisualization", disableDiffVisualization)
651-
await provider.postStateToWebview()
652-
break
653648
case "enableCheckpoints":
654649
const enableCheckpoints = message.bool ?? true
655650
await updateGlobalState("enableCheckpoints", enableCheckpoints)

src/shared/ExtensionMessage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ export type ExtensionState = Pick<
188188
| "terminalZdotdir"
189189
| "terminalCompressProgressBar"
190190
| "diffEnabled"
191-
| "disableDiffVisualization"
192191
| "fuzzyMatchThreshold"
193192
// | "experiments" // Optional in GlobalSettings, required here.
194193
| "language"

src/shared/WebviewMessage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export interface WebviewMessage {
8282
| "ttsSpeed"
8383
| "soundVolume"
8484
| "diffEnabled"
85-
| "disableDiffVisualization"
8685
| "enableCheckpoints"
8786
| "browserViewportSize"
8887
| "screenshotQuality"

src/shared/__tests__/experiments.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe("experiments", () => {
3030
marketplace: false,
3131
disableCompletionCommand: false,
3232
multiFileApplyDiff: false,
33+
disableDiffVisualization: false,
3334
}
3435
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
3536
})
@@ -40,6 +41,7 @@ describe("experiments", () => {
4041
marketplace: false,
4142
disableCompletionCommand: false,
4243
multiFileApplyDiff: false,
44+
disableDiffVisualization: false,
4345
}
4446
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(true)
4547
})
@@ -50,6 +52,7 @@ describe("experiments", () => {
5052
marketplace: false,
5153
disableCompletionCommand: false,
5254
multiFileApplyDiff: false,
55+
disableDiffVisualization: false,
5356
}
5457
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
5558
})
@@ -70,6 +73,7 @@ describe("experiments", () => {
7073
marketplace: false,
7174
disableCompletionCommand: false,
7275
multiFileApplyDiff: false,
76+
disableDiffVisualization: false,
7377
}
7478
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)
7579
})
@@ -80,6 +84,7 @@ describe("experiments", () => {
8084
marketplace: true,
8185
disableCompletionCommand: false,
8286
multiFileApplyDiff: false,
87+
disableDiffVisualization: false,
8388
}
8489
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(true)
8590
})

src/shared/experiments.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const EXPERIMENT_IDS = {
55
MULTI_FILE_APPLY_DIFF: "multiFileApplyDiff",
66
DISABLE_COMPLETION_COMMAND: "disableCompletionCommand",
77
POWER_STEERING: "powerSteering",
8+
DISABLE_DIFF_VISUALIZATION: "disableDiffVisualization",
89
} as const satisfies Record<string, ExperimentId>
910

1011
type _AssertExperimentIds = AssertEqual<Equals<ExperimentId, Values<typeof EXPERIMENT_IDS>>>
@@ -20,6 +21,7 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
2021
MULTI_FILE_APPLY_DIFF: { enabled: false },
2122
DISABLE_COMPLETION_COMMAND: { enabled: false },
2223
POWER_STEERING: { enabled: false },
24+
DISABLE_DIFF_VISUALIZATION: { enabled: false },
2325
}
2426

2527
export const experimentDefault = Object.fromEntries(

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const ApiOptions = ({
7373
setErrorMessage,
7474
}: ApiOptionsProps) => {
7575
const { t } = useAppTranslation()
76-
const { organizationAllowList, disableDiffVisualization, setDisableDiffVisualization } = useExtensionState()
76+
const { organizationAllowList } = useExtensionState()
7777

7878
const [customHeaders, setCustomHeaders] = useState<[string, string][]>(() => {
7979
const headers = apiConfiguration?.openAiHeaders || {}
@@ -476,19 +476,8 @@ const ApiOptions = ({
476476
<>
477477
<DiffSettingsControl
478478
diffEnabled={apiConfiguration.diffEnabled}
479-
disableDiffVisualization={disableDiffVisualization}
480479
fuzzyMatchThreshold={apiConfiguration.fuzzyMatchThreshold}
481-
onChange={(field, value) => {
482-
if (field === "disableDiffVisualization") {
483-
setDisableDiffVisualization(value)
484-
vscode.postMessage({
485-
type: "disableDiffVisualization",
486-
bool: value,
487-
})
488-
} else {
489-
setApiConfigurationField(field, value)
490-
}
491-
}}
480+
onChange={(field, value) => setApiConfigurationField(field, value)}
492481
/>
493482
<TemperatureControl
494483
value={apiConfiguration.modelTemperature}

0 commit comments

Comments
 (0)