How to force AI to provide the complete page when editing the code?

I am using AI to edit the code and it keeps offering the edits that I need to integrate myself.
In rare cases in is easy, but in like 99% of the occasions I have no idea how to do it.

May be AI could actually edit the code, not just provide suggestions?
And if that is not possible, may be there is a way to force AI to provide the complete code for the whole page, not just the edited parts?

I tried to asking AI to do so, but it works in like 10% of occasions, mostly I keep getting the code with comments like ā€œinsert the logic for this hereā€, which is kind of complicated for me at this stage.

Any suggestions?

Instead of using the AI tab to edit the code with artificial intelligence, you can use the suggested here: https://docs.replit.com/power-ups/replitai/explain-code

I definitely can, but that’s not the goal.
I want it to actually edit the code, not to explain it.

Hi @egorkaway, welcome to the forums!
You can highlight some code, right-click on that and click ā€˜edit’ or ā€˜generate’

That’s helpful but only works for the situation when the change is in just one line and you know which line exactly.

In case when there is 100 lines of code and you want to implement something that affects different parts of the code this does not work. One can select 100 lines, but once there is a click on ā€˜edit’ this selection drops and now only a smart portion of the code is selected.

Egorkaway,

You’ll want to use the generate code feature here: https://docs.replit.com/power-ups/replitai/generate-code . Take a look and let us know if you have any additional questions. Thanks!

Ok, tried Generate, it writes brand new code that misses many features of the original.

To summarise:

  • Modify selected in chat - offers on point suggestions but often replaces many parts of the code with ā€œinsert the rest of the code hereā€ which is not always obvious.
  • Modify selected in code itself - works only for a very short parts, about a line or 2 at a time.
  • Generate selected in chat - apart of changes you asked for, it rewrites the rest of the code completely and deletes existing design and features.

So, may be AI could actually edit the code, not just provide suggestions for the human to implement or write brand new code from scratch?

Ohhhhh, I see. You want the AI to actually be able to implement stuff by itself.

This is what I’ve always wanted too, but also it could mess up your entire file and you’d have to revert it if it really messes up.

1 Like

Yes, I understand that it might mess up and there might be need to undo.

I understand if there would be a step where it shows the suggestion before actually implementing the changes, but there might be a ā€œok, let’s actually do itā€ choice after the suggestion is shown.

Yeah, so what if you highlighted your entire code and used Edit Code?

As before: if you highlight too much text and choose Modify from the context - the selection becomes smaller.
There is no way to actually use Modify on the entire code, at least for me and at least for now.