zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.45k stars 3.12k forks source link

Changes applied from AI panel are prepended to code rather than replacing existing code #21002

Open fonnesbeck opened 16 hours ago

fonnesbeck commented 16 hours ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I'm having ongoing issues with making changes using suggestions from the AI panel. These were supposedly addressed by #19195 but I have seen no improvement, and the inline assist function is still generally unusable as the result. As an example, trying to apply a very clear, discrete change suggested for a single function:

image

You can see from the colors in the code status in the margin that things did not go well. Sure enough, if you scroll down to the bottom of the inserted text, it did not replace the code that it was meant to be refactoring, it just sort of pasted it in arbitrarily where the inline assist box was created.

image

The old code is just sitting there, and accepting the changes just creates a mess, with two versions of the same function, not even in a runnable state.

Environment

Zed: v0.162.3 (Zed) OS: Linux Wayland bluefin 41 Memory: 60.6 GiB Architecture: x86_64 GPU: AMD Radeon 780M (RADV GFX1103_R1) || radv || Mesa 24.2.4

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

fonnesbeck commented 13 hours ago

Another example on an entirely different code base. The suggested changes consist of a series of functions. In the hope of getting a better result, I said "Apply changes in the appropriate place in the code (not here)" to the instructions:

image

Bizarrely, all it did was append import jax to one of the other imports, which not only obviously breaks things, but has nothing to do with the suggested changes from the AI panel. This seems very broken at the moment.