Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions .changeset/disable-diff-visualization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"roo-cline": patch
---

Add experimental setting to disable diff visualization for all edit tools

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.
9 changes: 8 additions & 1 deletion packages/types/src/experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
* ExperimentId
*/

export const experimentIds = ["powerSteering", "disableCompletionCommand", "marketplace", "multiFileApplyDiff"] as const
export const experimentIds = [
"powerSteering",
"disableCompletionCommand",
"marketplace",
"multiFileApplyDiff",
"disableDiffVisualization",
] as const

export const experimentIdsSchema = z.enum(experimentIds)

Expand All @@ -21,6 +27,7 @@ export const experimentsSchema = z.object({
disableCompletionCommand: z.boolean().optional(),
marketplace: z.boolean().optional(),
multiFileApplyDiff: z.boolean().optional(),
disableDiffVisualization: z.boolean().optional(),
})

export type Experiments = z.infer<typeof experimentsSchema>
Expand Down
4 changes: 3 additions & 1 deletion src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export type TaskOptions = {
provider: ClineProvider
apiConfiguration: ProviderSettings
enableDiff?: boolean
disableDiffVisualization?: boolean
enableCheckpoints?: boolean
fuzzyMatchThreshold?: number
consecutiveMistakeLimit?: number
Expand Down Expand Up @@ -198,6 +199,7 @@ export class Task extends EventEmitter<ClineEvents> {
provider,
apiConfiguration,
enableDiff = false,
disableDiffVisualization = false,
enableCheckpoints = true,
fuzzyMatchThreshold = 1.0,
consecutiveMistakeLimit = 3,
Expand Down Expand Up @@ -242,7 +244,7 @@ export class Task extends EventEmitter<ClineEvents> {
this.consecutiveMistakeLimit = consecutiveMistakeLimit
this.providerRef = new WeakRef(provider)
this.globalStoragePath = provider.context.globalStorageUri.fsPath
this.diffViewProvider = new DiffViewProvider(this.cwd)
this.diffViewProvider = new DiffViewProvider(this.cwd, disableDiffVisualization)
this.enableCheckpoints = enableCheckpoints

this.rootTask = rootTask
Expand Down
6 changes: 6 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ export class ClineProvider
experiments,
} = await this.getState()

const disableDiffVisualization = experiments.disableDiffVisualization ?? false

if (!ProfileValidator.isProfileAllowed(apiConfiguration, organizationAllowList)) {
throw new OrganizationAllowListViolationError(t("common:errors.violated_organization_allowlist"))
}
Expand All @@ -542,6 +544,7 @@ export class ClineProvider
provider: this,
apiConfiguration,
enableDiff,
disableDiffVisualization,
enableCheckpoints,
fuzzyMatchThreshold,
task,
Expand Down Expand Up @@ -574,10 +577,13 @@ export class ClineProvider
experiments,
} = await this.getState()

const disableDiffVisualization = experiments.disableDiffVisualization ?? false

const cline = new Task({
provider: this,
apiConfiguration,
enableDiff,
disableDiffVisualization,
enableCheckpoints,
fuzzyMatchThreshold,
historyItem,
Expand Down
13 changes: 11 additions & 2 deletions src/integrations/editor/DiffViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export class DiffViewProvider {
private streamedLines: string[] = []
private preDiagnostics: [vscode.Uri, vscode.Diagnostic[]][] = []

constructor(private cwd: string) {}
constructor(
private cwd: string,
private disableDiffVisualization: boolean = false,
) {}

async open(relPath: string): Promise<void> {
this.relPath = relPath
Expand Down Expand Up @@ -92,7 +95,13 @@ export class DiffViewProvider {
this.documentWasOpen = true
}

this.activeDiffEditor = await this.openDiffEditor()
// If diff visualization is disabled, open the file directly
if (this.disableDiffVisualization) {
const document = await vscode.workspace.openTextDocument(absolutePath)
this.activeDiffEditor = await vscode.window.showTextDocument(document, { preview: false })
} else {
this.activeDiffEditor = await this.openDiffEditor()
}
this.fadedOverlayController = new DecorationController("fadedOverlay", this.activeDiffEditor)
this.activeLineController = new DecorationController("activeLine", this.activeDiffEditor)
// Apply faded overlay to all lines initially.
Expand Down
5 changes: 5 additions & 0 deletions src/shared/__tests__/experiments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe("experiments", () => {
marketplace: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
disableDiffVisualization: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
})
Expand All @@ -40,6 +41,7 @@ describe("experiments", () => {
marketplace: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
disableDiffVisualization: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(true)
})
Expand All @@ -50,6 +52,7 @@ describe("experiments", () => {
marketplace: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
disableDiffVisualization: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
})
Expand All @@ -70,6 +73,7 @@ describe("experiments", () => {
marketplace: false,
disableCompletionCommand: false,
multiFileApplyDiff: false,
disableDiffVisualization: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)
})
Expand All @@ -80,6 +84,7 @@ describe("experiments", () => {
marketplace: true,
disableCompletionCommand: false,
multiFileApplyDiff: false,
disableDiffVisualization: false,
}
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(true)
})
Expand Down
2 changes: 2 additions & 0 deletions src/shared/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const EXPERIMENT_IDS = {
MULTI_FILE_APPLY_DIFF: "multiFileApplyDiff",
DISABLE_COMPLETION_COMMAND: "disableCompletionCommand",
POWER_STEERING: "powerSteering",
DISABLE_DIFF_VISUALIZATION: "disableDiffVisualization",
} as const satisfies Record<string, ExperimentId>

type _AssertExperimentIds = AssertEqual<Equals<ExperimentId, Values<typeof EXPERIMENT_IDS>>>
Expand All @@ -20,6 +21,7 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
MULTI_FILE_APPLY_DIFF: { enabled: false },
DISABLE_COMPLETION_COMMAND: { enabled: false },
POWER_STEERING: { enabled: false },
DISABLE_DIFF_VISUALIZATION: { enabled: false },
}

export const experimentDefault = Object.fromEntries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ describe("mergeExtensionState", () => {
experiments: {
powerSteering: true,
marketplace: false,
concurrentFileReads: true,
disableCompletionCommand: false,
multiFileApplyDiff: true,
disableDiffVisualization: false,
} as Record<ExperimentId, boolean>,
}

Expand All @@ -239,9 +239,9 @@ describe("mergeExtensionState", () => {
expect(result.experiments).toEqual({
powerSteering: true,
marketplace: false,
concurrentFileReads: true,
disableCompletionCommand: false,
multiFileApplyDiff: true,
disableDiffVisualization: false,
})
})
})
4 changes: 4 additions & 0 deletions webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@
"MULTI_FILE_APPLY_DIFF": {
"name": "Enable concurrent file edits",
"description": "When enabled, Roo can edit multiple files in a single request. When disabled, Roo must edit files one at a time. Disabling this can help when working with less capable models or when you want more control over file modifications."
},
"DISABLE_DIFF_VISUALIZATION": {
"name": "Disable diff visualization for all edit tools",
"description": "When enabled, files will open directly in the editor instead of showing a diff view for all edit tools (write_to_file, apply_diff, insert_content, search_and_replace). This helps prevent LSP crashes with very large files. Changes are still visible in the chat window."
}
},
"promptCaching": {
Expand Down
Loading