yetone / avante.nvim

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

bug: @codebase not working #881

Open john-persson-polestar opened 1 day ago

john-persson-polestar commented 1 day ago

Describe the bug

I'm trying to chat with the codebase using @codebase, however Avante seams to have no context of file other than the on in my current buffer.

I.e. when asking about files that are imported in the current buffer, they are not in the context of Avante.


Avante: Would you like me to see the actual definition of FileName? Please share the context of Avante apps/products/app/routes/$locale.page-path/types/FileName.ts and I can provide more specific details.

and when I ask how to include them I will get the following answer:


Me: how do I share it with you? Avante: I can already see the code since you've shared it using the correct format with <filepath> and <code> tags. However, if you want me to see other files (like the SectionId type definition), you would need to share them in a similar way:

  1. First specify the filepath in <filepath> tags
  2. Then share the code content in <code> tags

For example, if you wanted to share the SectionId definition, you could share it like:


<filepath>apps/products/app/routes/$locale.page-path/types/FileName.ts</filepath>

// content of the SectionId file would go here

> Would you like to share any additional files with me?
---

### To reproduce

Ask a question to Avante with `@codebase` about files that are not part of the current buffer.

### Expected behavior

For Avante to have the full project context when asking questions using `@codebase`.

### Installation method

Use lazy.nvim:
```lua
{
  "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.1
Build type: Release
LuaJIT 2.1.1725453128

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
  },
})
john-persson-polestar commented 1 day ago

I can also add that I'm getting this error when asking a questions when there is no open buffer:

   Error  23:05:08 msg_show.emsg E5108: Error executing lua: ...ocal/share/nvim/lazy/avante.nvim/lua/avante/repo_map.lua:77: attempt to concatenate local 'file_ext' (a nil value)
stack traceback:
    ...ocal/share/nvim/lazy/avante.nvim/lua/avante/repo_map.lua:77: in function 'get_repo_map'
    ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1409: in function 'handle_submit'
    ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1488: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:1478>
   Error  23:05:10 msg_show.lua_error Error executing vim.schedule lua callback: ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: attempt to index local 'node' (a number value)
stack traceback:
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: in function 'get_checkbox'
    ...r-markdown.nvim/lua/render-markdown/render/list_item.lua:33: in function 'setup'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:80: in function 'callback'
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:190: in function 'query'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:76: in function 'parse'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:215: in function 'parse_tree'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:185: in function 'parse_buffer'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:122: in function 'run_update'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:88: in function <...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:87>
   Error  23:05:10 msg_show.lua_error Error executing vim.schedule lua callback: ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: attempt to index local 'node' (a number value)
stack traceback:
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: in function 'get_checkbox'
    ...r-markdown.nvim/lua/render-markdown/render/list_item.lua:33: in function 'setup'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:80: in function 'callback'
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:190: in function 'query'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:76: in function 'parse'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:215: in function 'parse_tree'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:185: in function 'parse_buffer'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:122: in function 'run_update'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:88: in function <...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:87>
   Error  23:05:20 msg_show.lua_error    Error executing vim.schedule lua callback: ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: attempt to index local 'node' (a number value)
stack traceback:
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:85: in function 'get_checkbox'
    ...r-markdown.nvim/lua/render-markdown/render/list_item.lua:33: in function 'setup'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:80: in function 'callback'
    ...ender-markdown.nvim/lua/render-markdown/core/context.lua:190: in function 'query'
    ...r-markdown.nvim/lua/render-markdown/handler/markdown.lua:76: in function 'parse'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:215: in function 'parse_tree'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:185: in function 'parse_buffer'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:122: in function 'run_update'
    ...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:88: in function <...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:87>
yetone commented 1 day ago

@john-persson-polestar It seems that your Avante is not the latest version. Can you upgrade to the latest version and try again?

john-persson-polestar commented 1 day ago

@yetone thank you for the quick response. I'm on the latest version (SHA: 341ecd207348841403ee4c2473864ef5c74ab710).