avante.nvim icon indicating copy to clipboard operation
avante.nvim copied to clipboard

bug: AvanteEdit doesn't work

Open andyl opened this issue 8 months ago • 2 comments

Describe the bug

Using Xubuntu 22.0, Neovim 0.10.4, and Lazy package manager. I tried with Avante 0.0.12, 0.0.18, 0.0.23.

When I select a visual range, and type :AvanteEdit, it doesn't work. Sometimes I get an error message "E481: No range allowed". Sometimes I get an error message "No visual selection found". Sometimes nothing happens. I try to invoke the command many times in a row. Something is broken.

To reproduce

  1. Select a range of text.
  2. Enter ":AvanteEdit"

Expected behavior

It works.

Installation method

Use lazy.nvim:

-- avante
--
-- Cursor-like ML / AI interface
--
-- https://github.com/yetone/avante.nvim

local lcl_opts = {
  'yetone/avante.nvim',
  -- event = "VeryLazy",
  -- lazy = false,
  version = false, -- always pull the latest change
  -- version = "v0.0.12",
  opts = {
    -- provider = "gemini",
    -- gemini = {
    --  model = "gemini-2.5-pro-exp-03-25"
    -- },
    behaviour = {
      auto_suggestion = false,
    },
    suggestion = {
      debounce = 600,
      throttle = 600,
    },
    hints = {
      enabled = false,
    },
  },
  build = "make",
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "stevearc/dressing.nvim",
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
    --- The below dependencies are optional
    "echasnovski/mini.pick",         -- for file_selector provider mini.pick
    "nvim-telescope/telescope.nvim", -- for file_selector provider telescope
    "hrsh7th/nvim-cmp",              -- autocompletion for avante commands and mentions
    "ibhagwan/fzf-lua",              -- for file_selector provider fzf
    "nvim-tree/nvim-web-devicons",   -- or echasnovski/mini.icons
    "zbirenbaum/copilot.lua",        -- for providers='copilot'
    {
      -- 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,
          },
          -- required for Windows users
          use_absolute_path = 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" },
    -- },
  },
}

return lcl_opts

Environment

Neovim 0.10.4

Xubuntu 22.04

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here
  },
})

andyl avatar Mar 30 '25 21:03 andyl

Hi, I am too after '<,'>AvanteEdit write code here I am receiving "E481: No Range Allowed". (Neovim 0.11.0 installed from nix on rockylinux).

:Verbose command AvanteEdit
    Name              Args Address Complete    Definition
    AvanteEdit        *                        <Lua 510: /apps/home/cukrowsk/.local/share/nvim/lazy/avante.nvim/plugin/avante.lua:105>
                                               avante: edit selected block
	Last set from /apps/home/cukrowsk/.local/share/nvim/lazy/avante.nvim/plugin/avante.lua (run Nvim with -V1 for more details)

Address is empty.. ? https://github.com/yetone/avante.nvim/blob/main/plugin/avante.lua#L106

Kamilcuk avatar Apr 01 '25 14:04 Kamilcuk

Hasn't worked for me for a long time. Just deletes the contents of wherever I ask it to edit something.

khaneliman avatar Apr 01 '25 15:04 khaneliman

Hi, I confirm it works. Opens a window "Avante edit selected block" with pre-filled text that I typed after the command and <C-s>: submit. Thank you. (fyi now I am hitting I think this bug https://github.com/neovim/neovim/issues/33224 , but it is related to neovim 0.11, works fine on 0.10.4)

Kamilcuk avatar Apr 02 '25 10:04 Kamilcuk

Confirm - seems to work now. THANK YOU @yetone

andyl avatar Apr 02 '25 19:04 andyl

Hasn't worked for me for a long time. Just deletes the contents of wherever I ask it to edit something.

Same here. I too have issues while trying to edit. It just removes the selection. VIM v0.11.2

bidhovbizar avatar Jul 28 '25 19:07 bidhovbizar