@@ -6,6 +6,7 @@ import { EXPERIMENT_IDS, ExperimentId } from "../../../../src/shared/experiments
66import { TERMINAL_OUTPUT_LIMIT } from "../../../../src/shared/terminal"
77
88import { cn } from "@/lib/utils"
9+ import { Select , SelectContent , SelectGroup , SelectItem , SelectTrigger , SelectValue } from "@/components/ui"
910
1011import { SetCachedStateField , SetExperimentEnabled } from "./types"
1112import { sliderLabelStyle } from "./styles"
@@ -43,6 +44,12 @@ export const AdvancedSettings = ({
4344 className,
4445 ...props
4546} : AdvancedSettingsProps ) => {
47+ const diffStrategy = experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ]
48+ ? "unified"
49+ : experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ]
50+ ? "multiBlock"
51+ : "standard"
52+
4653 return (
4754 < div className = { cn ( "flex flex-col gap-2" , className ) } { ...props } >
4855 < SectionHeader >
@@ -122,6 +129,7 @@ export const AdvancedSettings = ({
122129 checked = { diffEnabled }
123130 onChange = { ( e : any ) => {
124131 setCachedStateField ( "diffEnabled" , e . target . checked )
132+
125133 if ( ! e . target . checked ) {
126134 // Reset both experimental strategies when diffs are disabled.
127135 setExperimentEnabled ( EXPERIMENT_IDS . DIFF_STRATEGY , false )
@@ -135,19 +143,12 @@ export const AdvancedSettings = ({
135143 truncated full-file writes. Works best with the latest Claude 3.7 Sonnet model.
136144 </ p >
137145 { diffEnabled && (
138- < div className = "flex flex-col gap-2 mt-3 mb-2 pl-3 border-l-2 border-vscode-button-background" >
139- < div className = "flex flex-col gap-2" >
140- < span className = "font-medium" > Diff strategy</ span >
141- < select
142- value = {
143- experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ]
144- ? "unified"
145- : experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ]
146- ? "multiBlock"
147- : "standard"
148- }
149- onChange = { ( e ) => {
150- const value = e . target . value
146+ < div className = "flex flex-col gap-2 border-l-2 border-vscode-button-background pl-3" >
147+ < div >
148+ < div className = "font-medium" > Diff strategy</ div >
149+ < Select
150+ value = { diffStrategy }
151+ onValueChange = { ( value ) => {
151152 if ( value === "standard" ) {
152153 setExperimentEnabled ( EXPERIMENT_IDS . DIFF_STRATEGY , false )
153154 setExperimentEnabled ( EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE , false )
@@ -158,48 +159,52 @@ export const AdvancedSettings = ({
158159 setExperimentEnabled ( EXPERIMENT_IDS . DIFF_STRATEGY , false )
159160 setExperimentEnabled ( EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE , true )
160161 }
161- } }
162- className = "p-2 rounded w-full bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border outline-none focus:border-vscode-focusBorder" >
163- < option value = "standard" > Standard (Single block)</ option >
164- < option value = "multiBlock" > Experimental: Multi-block diff</ option >
165- < option value = "unified" > Experimental: Unified diff</ option >
166- </ select >
162+ } } >
163+ < SelectTrigger className = "w-full mt-1" >
164+ < SelectValue placeholder = "Select" />
165+ </ SelectTrigger >
166+ < SelectContent >
167+ < SelectGroup >
168+ < SelectItem value = "standard" > Standard (Single block)</ SelectItem >
169+ < SelectItem value = "multiBlock" > Experimental: Multi-block diff</ SelectItem >
170+ < SelectItem value = "unified" > Experimental: Unified diff</ SelectItem >
171+ </ SelectGroup >
172+ </ SelectContent >
173+ </ Select >
174+ < p className = "text-vscode-descriptionForeground text-sm mt-1" >
175+ { ! experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ] &&
176+ ! experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ] &&
177+ "Standard diff strategy applies changes to a single code block at a time." }
178+ { experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ] &&
179+ "Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach." }
180+ { experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ] &&
181+ "Multi-block diff strategy allows updating multiple code blocks in a file in one request." }
182+ </ p >
167183 </ div >
168-
169- { /* Description for selected strategy */ }
170- < p className = "text-vscode-descriptionForeground text-sm mt-1" >
171- { ! experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ] &&
172- ! experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ] &&
173- "Standard diff strategy applies changes to a single code block at a time." }
174- { experiments [ EXPERIMENT_IDS . DIFF_STRATEGY ] &&
175- "Unified diff strategy takes multiple approaches to applying diffs and chooses the best approach." }
176- { experiments [ EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ] &&
177- "Multi-block diff strategy allows updating multiple code blocks in a file in one request." }
178- </ p >
179-
180- { /* Match precision slider */ }
181- < span className = "font-medium mt-3" > Match precision</ span >
182- < div className = "flex items-center gap-2" >
183- < input
184- type = "range"
185- min = "0.8"
186- max = "1"
187- step = "0.005"
188- value = { fuzzyMatchThreshold ?? 1.0 }
189- onChange = { ( e ) => {
190- setCachedStateField ( "fuzzyMatchThreshold" , parseFloat ( e . target . value ) )
191- } }
192- className = "h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
193- />
194- < span style = { { ...sliderLabelStyle } } >
195- { Math . round ( ( fuzzyMatchThreshold || 1 ) * 100 ) } %
196- </ span >
184+ < div >
185+ < div className = "font-medium" > Match precision</ div >
186+ < div className = "flex items-center gap-2" >
187+ < input
188+ type = "range"
189+ min = "0.8"
190+ max = "1"
191+ step = "0.005"
192+ value = { fuzzyMatchThreshold ?? 1.0 }
193+ onChange = { ( e ) =>
194+ setCachedStateField ( "fuzzyMatchThreshold" , parseFloat ( e . target . value ) )
195+ }
196+ className = "h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
197+ />
198+ < span style = { { ...sliderLabelStyle } } >
199+ { Math . round ( ( fuzzyMatchThreshold || 1 ) * 100 ) } %
200+ </ span >
201+ </ div >
202+ < p className = "text-vscode-descriptionForeground text-sm mt-1" >
203+ This slider controls how precisely code sections must match when applying diffs.
204+ Lower values allow more flexible matching but increase the risk of incorrect
205+ replacements. Use values below 100% with extreme caution.
206+ </ p >
197207 </ div >
198- < p className = "text-vscode-descriptionForeground text-sm mt-0" >
199- This slider controls how precisely code sections must match when applying diffs. Lower
200- values allow more flexible matching but increase the risk of incorrect replacements. Use
201- values below 100% with extreme caution.
202- </ p >
203208 </ div >
204209 ) }
205210 </ div >
0 commit comments