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

bug: multiple apply to the same file have wrong diff lines #1179

Open
BhasherBEL opened this issue Feb 4, 2025 · 1 comment
Open

bug: multiple apply to the same file have wrong diff lines #1179

BhasherBEL opened this issue Feb 4, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@BhasherBEL
Copy link

BhasherBEL commented Feb 4, 2025

Describe the bug

When avante suggest multiple changes inside one file, the diff lines aren't recalculate when editing the file. This lead to the following apply to be applied to the wrong lines. This has already been highlighted partially in a comment in #967.

To reproduce

  • Ask a question that will generate changes in multiple places in a file.
  • Apply the first diff (with a different amount of lines that the original code)
  • Apply another diff
  • The diff will apply to the wrong lines and be completely inconsistant.

Expected behavior

The lines should be recalculated, or avante should know where to apply the diff even when another place in the file has already be edited.

Installation method

Use nixvim with all it's default settings:

programs.nixvim = {
  ...
  plugins = {
    ....
    avante = {
      enable = true;
      settings = {
        claude = {
          api_key_name = "cmd:cat /run/secrets/api/anthropic";
        };
      };
    };
  };
};

Environment

NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info

Linux desktop 6.12.11 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 23 16:23:05 UTC 2025 x86_64 GNU/Linux

Repro

@BhasherBEL BhasherBEL added the bug Something isn't working label Feb 4, 2025
@philipn
Copy link

philipn commented Feb 10, 2025

I have noticed this as well. To reproduce, simply use the 'a' option to apply one part of a multi-part diff rather than use 'A' to apply all diffs.

I think @yetone must use 'A' always or would have noticed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants