From 57cf9610ba0f6433172d6f6c4b3f5b634454b632 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Wed, 5 Mar 2025 13:00:27 -0500 Subject: [PATCH] Better UX for choosing between diff strategies --- .../components/settings/AdvancedSettings.tsx | 67 +++++++++++++------ .../settings/ExperimentalSettings.tsx | 2 +- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/webview-ui/src/components/settings/AdvancedSettings.tsx b/webview-ui/src/components/settings/AdvancedSettings.tsx index bdb8c30b8c..dd5fd44f88 100644 --- a/webview-ui/src/components/settings/AdvancedSettings.tsx +++ b/webview-ui/src/components/settings/AdvancedSettings.tsx @@ -2,7 +2,7 @@ import { HTMLAttributes } from "react" import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" import { Cog } from "lucide-react" -import { EXPERIMENT_IDS, experimentConfigsMap, ExperimentId } from "../../../../src/shared/experiments" +import { EXPERIMENT_IDS, ExperimentId } from "../../../../src/shared/experiments" import { cn } from "@/lib/utils" @@ -10,7 +10,6 @@ import { SetCachedStateField, SetExperimentEnabled } from "./types" import { sliderLabelStyle } from "./styles" import { SectionHeader } from "./SectionHeader" import { Section } from "./Section" -import { ExperimentalFeature } from "./ExperimentalFeature" type AdvancedSettingsProps = HTMLAttributes & { rateLimitSeconds: number @@ -118,8 +117,9 @@ export const AdvancedSettings = ({ onChange={(e: any) => { setCachedStateField("diffEnabled", e.target.checked) if (!e.target.checked) { - // Reset experimental strategy when diffs are disabled. + // Reset both experimental strategies when diffs are disabled. setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, false) + setExperimentEnabled(EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE, false) } }}> Enable editing through diffs @@ -129,17 +129,50 @@ export const AdvancedSettings = ({ truncated full-file writes. Works best with the latest Claude 3.7 Sonnet model.

{diffEnabled && ( -
- Match precision +
+
+ Diff strategy + +
+ + {/* Description for selected strategy */} +

+ {!experiments[EXPERIMENT_IDS.DIFF_STRATEGY] && + !experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] && + "Standard diff strategy applies changes to a single code block at a time."} + {experiments[EXPERIMENT_IDS.DIFF_STRATEGY] && + "Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach."} + {experiments[EXPERIMENT_IDS.MULTI_SEARCH_AND_REPLACE] && + "Multi-block diff strategy allows updating multiple code blocks in a file in one request."} +

+ + {/* Match precision slider */} + Match precision
- setExperimentEnabled(EXPERIMENT_IDS.DIFF_STRATEGY, enabled)} - />
)}
diff --git a/webview-ui/src/components/settings/ExperimentalSettings.tsx b/webview-ui/src/components/settings/ExperimentalSettings.tsx index bbf473dbd5..bbdfe47e89 100644 --- a/webview-ui/src/components/settings/ExperimentalSettings.tsx +++ b/webview-ui/src/components/settings/ExperimentalSettings.tsx @@ -36,7 +36,7 @@ export const ExperimentalSettings = ({
{Object.entries(experimentConfigsMap) - .filter((config) => config[0] !== "DIFF_STRATEGY") + .filter((config) => config[0] !== "DIFF_STRATEGY" && config[0] !== "MULTI_SEARCH_AND_REPLACE") .map((config) => (