yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
7.4k stars 274 forks source link

bug: Error while decoding suggestions #798

Open neevparikh opened 3 weeks ago

neevparikh commented 3 weeks ago

Describe the bug

When a suggestion has no changes, the code errors instead of doing nothing.

Error while decoding suggestions: After analyzing the code and cursor position at row 77, column 0, I don't see any necessary modifications to suggest. The code at and around this position is correctly formatted and follows best practices:                                                                                                                                                                                                                                                

1. The argument parser is properly configured                                                                                                                                                                                                                                                                                                                                                                                                                                                  
2. The Path type from pathlib is correctly used for file path handling                                                                                                                                                                                                                                                                                                                                                                                                                         
3. The indentation and structure are appropriate                                                                                                                                                                                                                                                                                                                                                                                                                                               
4. The argument definition is complete with type, required flag, and help text                                                                                                                                                                                                                                                                                                                                                                                                                 

Therefore, I return an empty list as no modifications are needed:                                                                                                                                                                                                                                                                                                                                                                                                                              

[]                                                                                                                                                               

image

To reproduce

No response

Expected behavior

The suggestion code should just do nothing if the LLM says there's nothing to be done.

Installation method

{ -- avante (AI code assistant)
    "yetone/avante.nvim",
    event = "VeryLazy",
    lazy = false,
    version = false, -- set this if you want to always pull the latest change
    opts = {
      provider = "claude",
      auto_suggestions_provider = "claude",
      claude = {
        endpoint = "https://api.anthropic.com",
        model = "claude-3-5-sonnet-20241022",
        temperature = 0,
        max_tokens = 4096,
      },
      behaviour = {
        auto_suggestions = true,
        auto_set_highlight_group = true,
        auto_set_keymaps = true,
        auto_apply_diff_after_generation = false,
        support_paste_from_clipboard = false,
      },
      mappings = {
        diff = {
          ours = "co",
          theirs = "ct",
          all_theirs = "ca",
          both = "cb",
          cursor = "cc",
          next = "]x",
          prev = "[x",
        },
        suggestion = {
          accept = "<M-l>",
          next = "<M-]>",
          prev = "<M-[>",
          dismiss = "<C-]>",
        },
        jump = {
          next = "]]",
          prev = "[[",
        },
        submit = {
          normal = "<CR>",
          insert = "<C-s>",
        },
        sidebar = {
          apply_all = "A",
          apply_cursor = "a",
          switch_windows = "<Tab>",
          reverse_switch_windows = "<S-Tab>",
        },
      },
      hints = { enabled = false },
      windows = {
        position = "smart", -- the position of the sidebar
        wrap = true, -- similar to vim.o.wrap
        width = 30, -- default % based on available width
        sidebar_header = {
          enabled = true, -- true, false to enable/disable the header
          align = "center", -- left, center, right for title
          rounded = true,
        },
        input = {
          prefix = "» ",
        },
        edit = {
          border = "rounded",
          start_insert = true, -- Start insert mode when opening the edit window
        },
        ask = {
          floating = false, -- Open the 'AvanteAsk' prompt in a floating window
          start_insert = true, -- Start insert mode when opening the ask window, only effective if floating = true.
          border = "rounded",
        },
      },
      highlights = {
        diff = {
          current = "DiffText",
          incoming = "DiffAdd",
        },
      },
      diff = {
        autojump = true,
        list_opener = "copen",
      },
    },
    -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
    build = "make",
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "stevearc/dressing.nvim",
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      --- The below dependencies are optional,
      "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
      {
        -- support for image pasting
        "HakonHarnes/img-clip.nvim",
        event = "VeryLazy",
        opts = {
          -- recommended settings
          default = {
            embed_image_as_base64 = false,
            prompt_for_file_name = false,
            drag_and_drop = {
              insert_mode = true,
            },
          },
        },
      },
      {
        -- Make sure to set this up properly if you have lazy=true
        "MeanderingProgrammer/render-markdown.nvim",
        opts = {
          file_types = { "markdown", "Avante" },
        },
        ft = { "markdown", "Avante" },
      },
    },

Environment

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

MacOS

Repro

No response

julian-meaningfulgigs commented 2 weeks ago

Bumping for same issue