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

Update editors when ChangeElement added or replaced #14901

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Feb 11, 2025

What it does

Fixes #14900 by updating any open editors referring to a given change proposal when the change proposal is updated.

I've put some thoughts together re: this problem here. This PR implements the Monaco editor update solution proposed there. I have a branch that uses the resource-based approach, but that has the problem that we consider the editor 'dirty.' Would be happy to discuss implementing any of the solutions proposed there, or any others. This one isn't my favorite, because it feels like a weird place to assign responsibility for updating the editors, but it does get around the issue of dirty editors most directly.

How to test

  1. Open a chat and use a prompt like

@Coder Remove the prefix "MCP" from all user message in packages/ai-mcp/src/browser/mcp-command-contribution.ts

  1. The agent should propose a change set. Open a diff for the file affected.
  2. Prompt the agent again with something like.

@Coder Actually, let's change the original MCP to CMP instead.

  1. The agent should suggest a new set of changes, and the content of the right side of the diff should be updated accordingly.

As I mention over on the issue, this means that any changes the user had made get wiped out. That's probably ok in a case like this, because the user chose to go back to the chat rather than use what had been proposed. On the other hand, if we chose to go with a solution like the Cline extension's, then the file would have been modified in place, and any changes the user made to the suggestions would be picked up by the agent in its second go around. On the other hand, it wouldn't see any MCP's to change to CMP, so it would fail on that count in this case. Lots of tradeoffs when trying to work intelligently with multiple potential versions of the same text 🤷 .

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@colin-grant-work
Copy link
Contributor Author

Converting this to a draft for now, because I think I can do better as part of a larger reconfiguration of the AI diff editor UX.

@colin-grant-work colin-grant-work marked this pull request as draft February 12, 2025 16:19
@colin-grant-work colin-grant-work mentioned this pull request Feb 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

[Theia AI] Diff editor does not update to new changes
1 participant