-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the user to switch between and configure the two implemented edit strategies #280
base: main
Are you sure you want to change the base?
Conversation
- Added support for selecting between 'unified' and 'search-replace' diff strategies in the Cline class and related components. - Updated the getDiffStrategy function to accept a strategy parameter. - Enhanced the ClineProvider to manage and persist the selected diff strategy in the global state. - Modified the SettingsView to allow users to choose the diff strategy and adjust related settings dynamically. - Introduced fuzz factor control for the unified diff strategy to fine-tune matching precision.
…uctions - Introduced a fuzz factor parameter in the UnifiedDiffStrategy constructor to improve patch application precision. - Updated the tool description to clarify the usage of unified diff format and added detailed guidelines for applying diffs. - Removed outdated common pitfalls and best practices sections, replacing them with more relevant instructions for handling code changes and formatting requirements.
|
I need to solve an issue before this can be merged, I will open a new PR |
…g tools in an existing task. -Since the tool description is sent when the task is created, the diff strategy can't be changed on existing tasks - Refactored code to ensure diff strategy is correctly restored from task history.
Due to the current way we handle tasks, |
Oh that's too bad. How badly does it get stuck? I wonder if we could recover faster by including the instructions for the diff strategy in the rejectTool message. |
With these changes we can only use one strategy per task, meaning you can't change the strategy for existing tasks/chats. However the PR is complete, it implements the dropdown to select the strategy and also the slider to adjust the fuzziness of the strategy individually. For implementing strategy switching we could:
You also mentioned reminding the model of how to implement the changes with the reject message, I considered this idea but discarded it since it can potentially use a lot of tokens if the error happens repeatedly. |
ff5483c
to
8fc26fa
Compare
Heads up that I ran prettier on the whole codebase in #404, and it will run automatically in a pre-commit hook going forward. In order to bring this PR up to date on formatting you'll need to run |
Description
Allow the user to switch between the two implemented edit strategies, unified diff and search/replace and also allowing the user to change the fuzziness of the selected strategy.
Improved the prompt used by the unified diff strategy to encourage the model to produce better diffs, the improved prompt is based on the previous prompt but restructuring it to use positive instructions, these changes are inspired on Aider's unified diff prompts.
Type of change
How Has This Been Tested?
I have used Roo Cline with both strategies selected on real-life projects while it still makes mistakes it allows me to switch to another strategy if the model gets stuck with the previous one. I recommend further testing specifically in the accuracy of the new unified diff prompt.
Checklist:
Additional context
Unified Diff:
Search/Replace:
Editing using diffs disabled:
Related Issues
Reviewers
Important
This PR adds functionality to switch between 'unified' and 'search-replace' edit strategies with adjustable fuzziness, updating both backend logic and UI components.
Cline.ts
.UnifiedDiffStrategy
andSearchReplaceDiffStrategy
.SettingsView.tsx
to include dropdown for selecting diff strategy and sliders for fuzziness.WebviewMessage
.getDiffStrategy()
inDiffStrategy.ts
to accept strategy type and fuzziness.ClineProvider.ts
to handle new settings and persist them in global state.This description was created by for cad274d. It will automatically update as commits are pushed.