Skip to content
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

feat: add diff strategy selection in chat text area #525

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

monotykamary
Copy link

@monotykamary monotykamary commented Jan 24, 2025

Description

This PR introduces a new "Diff Strategy" dropdown to the chat input area in ChatTextArea.tsx. This dropdown allows users to dynamically control the diff strategy used for code edits directly from the chat interface.

The following options are available in the dropdown:

  • Disable Diff (whole): Disables the diffing feature, reverting to whole-file replacements.
  • Search Replace Diff (search-replace): Enables the default diff strategy, utilizing search and replace for efficient code modifications.
  • Unified Diff (Experimental) (unified-diff): Activates the experimental unified diff strategy, potentially improving diff accuracy but with a risk of unexpected behavior.

This enhancement provides users with more granular control over the code editing process and allows for easier experimentation with different diff strategies.

Type of change

  • New feature
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

This change has been manually tested by:

  • Verifying that the new "Diff Strategy" dropdown appears in the chat input area.
  • Confirming that changing the dropdown options correctly updates the diff behavior (disabling diff, using search-replace, and using unified-diff strategies).
  • Ensuring that the initial value of the dropdown reflects the current diff settings.

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

BEFORE:
image

AFTER:
image
image

Related Issues

Reviewers


Important

Adds a "Diff Strategy" dropdown in ChatTextArea.tsx for selecting code diff strategies, updating state based on user selection.

  • Behavior:
    • Adds "Diff Strategy" dropdown in ChatTextArea.tsx for selecting diff strategies: "Disable Diff (whole)", "Search Replace Diff (search-replace)", and "Unified Diff (Experimental) (unified-diff)".
    • Updates diffStrategy state based on diffEnabled and experimentalDiffStrategy from useExtensionState().
    • Dropdown changes update diffEnabled and experimentalDiffStrategy states accordingly.
  • UI:
    • Dropdown is disabled when textAreaDisabled is true.
    • Dropdown is styled with selectStyle and caretContainerStyle.

This description was created by Ellipsis for 0afe08d. It will automatically update as commits are pushed.

Copy link

changeset-bot bot commented Jan 24, 2025

⚠️ No Changeset found

Latest commit: 5ced55c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

monotykamary and others added 3 commits January 24, 2025 16:21
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@mrubens
Copy link
Collaborator

mrubens commented Jan 25, 2025

I like the idea of making this option more visible than where it currently is, but I think the chat text area is too prominent for the amount that I expect people will need to change this.

I’ve been thinking about what a middle ground would be, and think it might be something like showing it and other advanced options in the area above the chat input when a task is not active - more visible, but out of your way when you’re actually working on a task. Not sure the details and there are other options too, but just wanted to share my perspective. What do you think?

@monotykamary
Copy link
Author

Same thoughts. Maybe an aider approach would be a bit better, where we can assign modes to their own edit strategy and replace the current checklist into this dropdown 🤔

@mrubens
Copy link
Collaborator

mrubens commented Jan 28, 2025

Same thoughts. Maybe an aider approach would be a bit better, where we can assign modes to their own edit strategy and replace the current checklist into this dropdown 🤔

Oh interesting - so maybe we add dropdown for diff type in the API configuration profiles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants