diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index c4b23325..978016f7 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -1224,13 +1224,16 @@ class EditCodeService extends Disposable implements IEditCodeService { public async startApplying(opts: StartApplyingOpts): Promise<[URI, Promise] | null> { let res: [DiffZone, Promise] | undefined = undefined - if (Math.random() > 0) { - console.log('writeover....') - res = await this._initializeWriteoverStream(opts) - } else { - - if (opts.type === 'rewrite') res = await this._initializeWriteoverStream(opts) - else if (opts.type === 'searchReplace') res = await this._initializeSearchAndReplaceStream(opts) + if (opts.from === 'QuickEdit') { + res = await this._initializeWriteoverStream(opts) // rewrite + } + else if (opts.from === 'ClickApply') { + if (this._settingsService.state.globalSettings.enableFastApply) { + res = await this._initializeSearchAndReplaceStream(opts) // fast apply + } + else { + res = await this._initializeWriteoverStream(opts) // rewrite + } } if (!res) return null diff --git a/src/vs/workbench/contrib/void/browser/editCodeServiceInterface.ts b/src/vs/workbench/contrib/void/browser/editCodeServiceInterface.ts index bdcdc05e..e9b1f49e 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeServiceInterface.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeServiceInterface.ts @@ -13,11 +13,9 @@ import { createDecorator } from '../../../../platform/instantiation/common/insta export type StartApplyingOpts = ({ from: 'QuickEdit'; - type: 'rewrite'; diffareaid: number; // id of the CtrlK area (contains text selection) } | { from: 'ClickApply'; - type: 'searchReplace' | 'rewrite'; applyStr: string; uri: 'current' | URI; startBehavior: 'accept-conflicts' | 'reject-conflicts'; diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx index a0e0ec4d..eb00ff52 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx @@ -123,7 +123,6 @@ export const useApplyButtonHTML = ({ codeStr, applyBoxId }: { codeStr: string, a if (getStreamState() === 'streaming') return const [newApplyingUri, _] = await editCodeService.startApplying({ from: 'ClickApply', - type: 'searchReplace', applyStr: codeStr, uri: 'current', startBehavior: 'reject-conflicts', diff --git a/src/vs/workbench/contrib/void/browser/react/src/quick-edit-tsx/QuickEditChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/quick-edit-tsx/QuickEditChat.tsx index e42755c1..01a56226 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/quick-edit-tsx/QuickEditChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/quick-edit-tsx/QuickEditChat.tsx @@ -62,7 +62,6 @@ export const QuickEditChat = ({ editCodeService.startApplying({ from: 'QuickEdit', - type: 'rewrite', diffareaid, }) }, [isStreamingRef, isDisabled, editCodeService, diffareaid]) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 18d3cead..2427634c 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -363,7 +363,7 @@ export const VoidChatArea: React.FC = ({ {showModelDropdown && (
- +
)} diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index 069ed703..770df495 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -460,7 +460,7 @@ export const VoidCheckBox = ({ label, value, onClick, className }: { label: stri -export const VoidCustomDropdownBox = ({ +export const VoidCustomDropdownBox = >({ options, selectedOption, onChangeOption, @@ -537,7 +537,7 @@ export const VoidCustomDropdownBox = ({ // if the selected option is null, set the selection to the 0th option useEffect(() => { if (options.length === 0) return - if (selectedOption) return + if (selectedOption !== undefined) return onChangeOption(options[0]) }, [selectedOption, onChangeOption, options]) @@ -566,7 +566,7 @@ export const VoidCustomDropdownBox = ({ return () => document.removeEventListener('mousedown', handleClickOutside); }, [isOpen, refs.floating, refs.reference]); - if (!selectedOption) + if (selectedOption === undefined) return null return ( diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/ModelDropdown.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/ModelDropdown.tsx index f4943936..42f4de23 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/ModelDropdown.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/ModelDropdown.tsx @@ -21,7 +21,7 @@ const optionsEqual = (m1: ModelOption[], m2: ModelOption[]) => { return true } -const ModelSelectBox = ({ options, featureName }: { options: ModelOption[], featureName: FeatureName }) => { +const ModelSelectBox = ({ options, featureName, className }: { options: ModelOption[], featureName: FeatureName, className: string }) => { const accessor = useAccessor() const voidSettingsService = accessor.get('IVoidSettingsService') @@ -40,7 +40,7 @@ const ModelSelectBox = ({ options, featureName }: { options: ModelOption[], feat getOptionDropdownName={(option) => option.selection.modelName} getOptionDropdownDetail={(option) => option.selection.providerName} getOptionsEqual={(a, b) => optionsEqual([a], [b])} - className='text-xs text-void-fg-3' + className={className} matchInputWidth={false} /> } @@ -77,7 +77,7 @@ const ModelSelectBox = ({ options, featureName }: { options: ModelOption[], feat -const MemoizedModelDropdown = ({ featureName }: { featureName: FeatureName }) => { +const MemoizedModelDropdown = ({ featureName, className }: { featureName: FeatureName, className: string }) => { const settingsState = useSettingsState() const oldOptionsRef = useRef([]) const [memoizedOptions, setMemoizedOptions] = useState(oldOptionsRef.current) @@ -98,11 +98,11 @@ const MemoizedModelDropdown = ({ featureName }: { featureName: FeatureName }) => return } - return + return } -export const ModelDropdown = ({ featureName }: { featureName: FeatureName }) => { +export const ModelDropdown = ({ featureName, className }: { featureName: FeatureName, className: string }) => { const settingsState = useSettingsState() const accessor = useAccessor() @@ -123,5 +123,5 @@ export const ModelDropdown = ({ featureName }: { featureName: FeatureName }) => : 'Provider required' } /> - return + return } diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 3eb18fe6..58965f9f 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -398,6 +398,30 @@ export const AIInstructionsBox = () => { /> } +const FastApplyMethodDropdown = () => { + const accessor = useAccessor() + const voidSettingsService = accessor.get('IVoidSettingsService') + + const options = useMemo(() => [true, false], []) + + const onChangeOption = useCallback((newVal: boolean) => { + voidSettingsService.setGlobalSetting('enableFastApply', newVal) + }, [voidSettingsService]) + + return val ? 'Fast Apply' : 'Slow Apply'} + getOptionDropdownName={(val) => val ? 'Fast Apply' : 'Slow Apply'} + getOptionDropdownDetail={(val) => val ? 'Output Search/Replace blocks' : 'Rewrite whole files'} + getOptionsEqual={(a, b) => a === b} + /> + +} + + export const FeaturesTab = () => { const voidSettingsState = useSettingsState() const accessor = useAccessor() @@ -445,42 +469,66 @@ export const FeaturesTab = () => {

Feature Options

+ {/* FIM */}

{displayInfoOfFeatureName('Autocomplete')}

-
Experimental. Only works with models that support FIM.
-
- voidSettingsService.setGlobalSetting('enableAutocomplete', newVal)} - /> - {voidSettingsState.globalSettings.enableAutocomplete ? 'Enabled' : 'Disabled'} +
Experimental. Only works with models that support FIM.
+ +
+ {/* Enable Switch */} +
+ voidSettingsService.setGlobalSetting('enableAutocomplete', newVal)} + /> + {voidSettingsState.globalSettings.enableAutocomplete ? 'Enabled' : 'Disabled'} +
+ {/* Model Dropdown */} +
+ +
-
- -
+ {/* Apply */}

{displayInfoOfFeatureName('Apply')}

-
If you customize this, we recommend using Claude 3.7 or DeepSeek R1.
-
- voidSettingsService.setGlobalSetting('syncFastApplyToChat', !newVal)} - /> - {voidSettingsState.globalSettings.syncFastApplyToChat ? 'Sync with Chat' : 'Use Another Model'} +
Settings that control the behavior of the Apply button and the Edit tool.
+ +
+ {/* Sync to Chat Switch */} +
+ voidSettingsService.setGlobalSetting('syncApplyToChat', newVal)} + /> + {voidSettingsState.globalSettings.syncApplyToChat ? 'Sync with Chat model' : 'Use another model'} +
+ + {/* Model Dropdown */} +
+ +
-
- + +
+ {/* Fast Apply Method Dropdown */} +
+ +
+ +
+
+ diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index fb061bc1..d740a26d 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -330,7 +330,6 @@ export class ToolsService implements IToolsService { uri, applyStr: changeDescription, from: 'ClickApply', - type: 'searchReplace', startBehavior: 'accept-conflicts', }) ?? [] await applyDonePromise diff --git a/src/vs/workbench/contrib/void/common/voidSettingsService.ts b/src/vs/workbench/contrib/void/common/voidSettingsService.ts index 92940f92..fd0f973b 100644 --- a/src/vs/workbench/contrib/void/common/voidSettingsService.ts +++ b/src/vs/workbench/contrib/void/common/voidSettingsService.ts @@ -273,11 +273,10 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { } - private _onUpdate_syncFastApplyToChat() { + private _onUpdate_syncApplyToChat() { // if sync is turned on, sync (call this whenever Chat model or !!sync changes) - if (this.state.globalSettings.syncFastApplyToChat) { - this.setModelSelectionOfFeature('Apply', deepClone(this.state.modelSelectionOfFeature['Chat'])) - } + this.setModelSelectionOfFeature('Apply', deepClone(this.state.modelSelectionOfFeature['Chat'])) + } setGlobalSetting: SetGlobalSettingFn = async (settingName, newVal) => { @@ -293,7 +292,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { this._onDidChangeState.fire() // hooks - this._onUpdate_syncFastApplyToChat() + if (this.state.globalSettings.syncApplyToChat) this._onUpdate_syncApplyToChat() } @@ -312,7 +311,9 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { this._onDidChangeState.fire() // hooks - if (featureName === 'Chat') { this._onUpdate_syncFastApplyToChat() } + if (featureName === 'Chat') { + if (this.state.globalSettings.syncApplyToChat) this._onUpdate_syncApplyToChat() + } } diff --git a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts index 01b07d65..f5516ff3 100644 --- a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts +++ b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts @@ -324,7 +324,7 @@ export const displayInfoOfFeatureName = (featureName: FeatureName) => { else if (featureName === 'Chat') return 'Chat' else if (featureName === 'Apply') - return 'Fast Apply' + return 'Apply' else throw new Error(`Feature Name ${featureName} not allowed`) } @@ -385,14 +385,16 @@ export type GlobalSettings = { autoRefreshModels: boolean; aiInstructions: string; enableAutocomplete: boolean; - syncFastApplyToChat: boolean; + syncApplyToChat: boolean; + enableFastApply: boolean; } export const defaultGlobalSettings: GlobalSettings = { autoRefreshModels: true, aiInstructions: '', enableAutocomplete: false, - syncFastApplyToChat: true, + syncApplyToChat: true, + enableFastApply: true, } export type GlobalSettingName = keyof GlobalSettings