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

Add search and replace function to coder #14774

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

Conversation

JonasHelming
Copy link
Contributor

fixed #14773

What it does

  • Add a new function allowing to search and replace content in files. This is more efficient in big files, as the LLM has less to output compared to replacing the full file.
  • Add a ContentReplacer to apply Search and Replace tuples including a match strategy ignoring white spaces
  • Add an alternative prompt variant to Coder using the new function as an alternative to full file replace. The LLM can choose which function to use

How to test

Switch the prompt of Coder to "coder-search-replace" and try it. Some example prompts:

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

'@coder Do not display a message to the user anymore about the tools in packages/ai-mcp/src/browser/mcp-command-contribution.ts'

'@coder Allow the user to start already started MCP servers again in packages/ai-mcp/src/browser/mcp-command-contribution.ts'

and also try prompts that should trigger the replace still, e.g.:

'@coder Implement the interface MCPServerManager in the same file (packages/ai-mcp/src/common/mcp-server-manager.ts). Don't ask me anything, jut do it.'

Follow-ups

Test the two variants and decide what should be the default.

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

@JonasHelming JonasHelming requested a review from planger January 26, 2025 23:47
Copy link
Contributor

@eneufeld eneufeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and works fine.
The only downside is, that I have to explicitly tell the agent to create the change in chunks as it tends to use the replace whole file function for me.

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] Speed up the generation of changes of coder agent
2 participants