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: Error when attempting to add suggestions from chat #704

Open
Vanclief opened this issue Oct 10, 2024 · 0 comments
Open

bug: Error when attempting to add suggestions from chat #704

Vanclief opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Vanclief
Copy link

Vanclief commented Oct 10, 2024

Describe the bug

I have the default configuration with Avante, I can open the sidebar and start chatting. However sometimes when trying to apply suggestions I get this error:

E5108: Error executing lua: ...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:452: attempt to index local 'code' (a nil value)
stack traceback:
	...al/share/nvim/lazy/avante.nvim/lua/avante/utils/init.lua:452: in function 'remove_indentation'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:382: in function 'ensure_snippets_no_overlap'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:494: in function 'apply'
	...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:690: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:690>

To reproduce

  1. Opened a .go file
  2. aa
  3. Ask to do anything with the file
  4. Apply the suggestion

However the behavior is inconsistent, I haven't figured out how to replicate this reliably.

Expected behavior

The suggestion should be applied without creating an error 100% of the times

Installation method

Use lazy.nvim:

{
  "yetone/avante.nvim",
  event = "VeryLazy",
  lazy = false,
  version = false, -- set this if you want to always pull the latest change
  opts = {
    -- add any opts here
  },
  -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
  build = "make",
  -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "stevearc/dressing.nvim",
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

Environment

NVIM v0.10.2
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128
Linux budapest 6.11.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 04 Oct 2024 21:51:11 +0000 x86_64 GNU/Linux

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
  },
})
@Vanclief Vanclief added the bug Something isn't working label Oct 10, 2024
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

1 participant