How do you make Cody making modifications across multiple files at the same time?

I really like the Cody edit function: select the whole content in a file and submit a request for a refactor then it will do the magic. But sometimes we need to refactor across multiple files, how can I select multiple files and submit a refactor request, then let Cody change the code simultaneously across various files?

5 Likes

Hey @shallker great question. Right now, it isn’t possible but I will make sure the product team sees this in the weekly community feedback report.

What other features are you enjoying? How can they be better?

I would really love to see this feature. in my opinion it’s so critical - i really don’t know how it wasn’t done yet. it’s so simple to implement, yet i think it’s a real game changer.

imagine just telling cody:
add a ajax form to this page, and cody would add some css to the css file, some html / php / jsx to the current file, and some ajax related functions to another file in one go… isn’t it a life changer?

2 Likes

Also - it would be great to be able to tell cody to edit a file from the chat. so for example i ask cody:

how would i make this function more secure and cody answers, and i ask him, but maybe this way? and he answers, and then i tell him:
great. do that.

A life changer in my opinion.

1 Like

This would be awesome addition, for example like Cursor composer and Claud Dev.

Hello @benadam This functionality is now available as “Smart Apply” feature from the Cody Chat where you can apply code blocks to multiple files in a sequentially way manually controlled by the user.
You can read more here.

1 Like

Thanks @PriNova,

This is really exciting. I tried it today.

I did stumble across two problems:

  1. A lot of time it doesn’t get the code in the right place in the file. just drops it in the end.
  2. It is never putting the code in the file it says the code should be written in, unless it is the current file.

Btw - for me at least, it also works very very slow.

You are welcome.

Yes, I observed it sometimes too, but hard to pin point it.

  1. My observations is so far, that if it is a entire function, it is placed at the end of the file (not always). Not bad if the language support out-of-order function definitions.
  2. If it is a new file, it works for me, if it is a change in a file, which is not opened in a tab it sometimes fails, but w/o observable pattern

The slowness is known and they are working on it.

Thanks for reporting.

Related to this, I have simply seen VSCode’s Cody integration stop making multiple edits. It was working for awhile, and not isn’t making any changes without a specific single file context, even as it tells me again and again that it is doing so.

There’s a weird bug where in conversations it randomly stops being able to see the code, yet insists that it can see it, yet no longer can make any edits, or reverts to older version of the code. Is your comment similar?

It will agree “Yes, I’ll do X”, “OK do it now”, “OK, I’ll do now”, etc. in each subsequent comment but never actually outputs any code changes anymore.

This happens especially in long lasting conversation. My suggestion is to start a new chat and continue where you left off from the old one.

I don’t see editing across multiple files feature working.

This feature is called “Smart Apply” and needs to be triggered manually, which is much more reliable because of pre-evaluating if the changes are aligned with the task at hand.