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: can't open new windows #815

Closed
nikisix opened this issue Nov 6, 2024 · 9 comments
Closed

bug: can't open new windows #815

nikisix opened this issue Nov 6, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@nikisix
Copy link

nikisix commented Nov 6, 2024

Describe the bug

Fresh avante install, built from source b/c on an macOS arm M2 chip.

:AvanteToggle

Error executing Lua callback: ...site/pack/lazy/opt/avante.nvim/lua/avante/suggestion.lua:38: attempt to index field 'behaviour' (a nil value)
stack traceback:
        ...site/pack/lazy/opt/avante.nvim/lua/avante/suggestion.lua:38: in function 'new'
        ...arvim/site/pack/lazy/opt/avante.nvim/lua/avante/init.lua:274: in function '_init'
        ...arvim/site/pack/lazy/opt/avante.nvim/lua/avante/init.lua:290: in function 'toggle_sidebar'
        ...arvim/site/pack/lazy/opt/avante.nvim/lua/avante/init.lua:348: in function 'toggle'
        ...unarvim/site/pack/lazy/opt/avante.nvim/plugin/avante.lua:87: in function <...unarvim/site/pack/lazy/opt/avante.nvim/plugin/avante.lua:87>

:AvanteAsk

Error executing Lua callback: ...narvim/site/pack/lazy/opt/avante.nvim/lua/avante/api.lua:123: attempt to index field 'windows' (a nil value)
stack traceback:
        ...narvim/site/pack/lazy/opt/avante.nvim/lua/avante/api.lua:123: in function 'ask'
        ...unarvim/site/pack/lazy/opt/avante.nvim/plugin/avante.lua:69: in function <...unarvim/site/pack/lazy/opt/avante.nvim/plugin/avante.lua:53>

Using default lazy.vim* config:

  { -- claude ai
    "yetone/avante.nvim",
    event = "VeryLazy",
    lazy = false,
    version = true, -- set this if you want to always pull the latest change
    opts = {
      -- add any opts here
      debug = true
    },
    -- 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",
      --- The below dependencies are optional,
      "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,
          },
        },
      },
    },

To reproduce

No response

Expected behavior

No response

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

LUNARVIM: release-1.4/neovim-0.9-d15c8d7
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1727870382

OSX ARM M2

Repro

No response

@nikisix nikisix added the bug Something isn't working label Nov 6, 2024
@robertocommit
Copy link

robertocommit commented Nov 8, 2024

I had the same issue, probably because I am using Packer instead of the methods listed in the README.

Here my working config for packer:

use {
  'yetone/avante.nvim',
  requires = {
    'nvim-treesitter/nvim-treesitter',
    'stevearc/dressing.nvim',
    'nvim-lua/plenary.nvim',
    'MunifTanjim/nui.nvim',
    'nvim-tree/nvim-web-devicons',
    'zbirenbaum/copilot.lua',
    {
      'HakonHarnes/img-clip.nvim',
      config = function()
        require('img-clip').setup({
          -- your config
        })
      end
    },
    {
      'MeanderingProgrammer/render-markdown.nvim',
      config = function()
        require('render-markdown').setup({
          file_types = { "markdown", "Avante" }
        })
      end
    }
  },
  config = function()
    require('copilot').setup({
      -- your config
    })
    require('avante_lib').load()
    require('avante').setup({
      -- your config
    })
  end
}

@yetone could we include Packer in your README?

Hope this helps

@Lr-2002
Copy link

Lr-2002 commented Nov 16, 2024

yep, I'm facing the save problem using the vim-plug in nvim

Plug('yetone/avante.nvim', {['branch'] = 'main', ['do'] = 'make'})



-- some usage 

require('avante_lib').load()

and the windows was traceback because of the nil value, Any possible reason?
@yetone
thx for your amazing work

@Lr-2002
Copy link

Lr-2002 commented Nov 16, 2024

more info, might help, If I print the Config in api.lua, it shows nil
while
if I print the M.defaults in Config.lua, it show the info and I could access the value of windows with M.defaults.windows

@victorhsb
Copy link

Hello @nikisix I am having the same problem with my Mac M2. And i just tested on a fresh install on my windows running WSL (Ubuntu) and it worked first try!

@nikisix
Copy link
Author

nikisix commented Nov 19, 2024 via email

@Lr-2002
Copy link

Lr-2002 commented Nov 19, 2024

more info, might help, If I print the Config in api.lua, it shows nil while if I print the M.defaults in Config.lua, it show the info and I could access the value of windows with M.defaults.windows

We have fixed this problem with the help of @yetone
The reason are as listed:

  1. the Vim-Plug did not really do the make, which cause the repo_map error (which would appear), so you need to change to ~/.local/share/nvim/plugged/avante.nvim, to run the make command
  2. you need to load and then setup, this should be work like this :
vim.call('plug#begin')
Plug('yetone/avante.nvim', {['branch']='main', ['do']= 'make' })
vim.call('plug#end')
-- some other config 

require('avante_lib').load()
require('avante').setup()

and then it will work out.

Thx @yetone for his help again !

@yetone
Copy link
Owner

yetone commented Nov 21, 2024

If your plugin manager is not lazy.nvim, then you must ensure the following two lines are executed:

require('avante_lib').load()
require('avante').setup()

@yetone yetone closed this as completed Nov 21, 2024
@yetone yetone pinned this issue Nov 21, 2024
@nikisix
Copy link
Author

nikisix commented Nov 21, 2024

But my plugin manager is lazy.nvim ..

@yetone
Copy link
Owner

yetone commented Nov 23, 2024

But my plugin manager is lazy.nvim ..

Then you can manually execute these two lines of code:

require('avante_lib').load()
require('avante').setup()

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

5 participants