This fixes a bunch of errors I was getting when switching away from the
avante sidebar and then back. Sometimes the sidebar would lose track of
the various windows, and you'd get errors like this:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
Or this one:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
This change does the following:
1. Proper order of cleanup in `reset()`
2. Proper cleanup in `create_selected_files_container()`
This fix is required for users with vim.o.virtualedit="all". Otherwise,
the cursor remains at the end of the prompt and has to be manually moved
back before entering the next prompt.
* Add helper function to check for dev icon availability
* Add function to display dev icon or nothing if icon plugins unavailable
* Fix existing use of icons
* Reformat with stylua
Neovim allows quickfix list to be populated in a variety of ways: grep,
lsp symbol references etc. Being able to add files in the quickfix
window to the LLM chat context allows for interesting workflows. For
example, one could search for a symbol using the LSP integration,
populate the quickfix with that list and then pass those along as
context in Avante using @quickfix mention in the sidebar.
If there are no files in the quickfix list or the items do not have a
file, nothing is added to the context.
* feat(sidebar): supports select files
chore (context) update add type annotations to context functions
chore (sidebar) remove unused notify function call
refactor (sidebar) remove setting search file to file path
chore (sidebar) remove nvim_notify debugging api call
* feat (files) allow selecting a file by string via cmp suggestion menu
* chore (context) refactor to allow context using @file with a context view
* refactor (context) refactor seletected file types as an array of path and content
* refactor (config) remove unused configuration options
* refactor (sidebar) remove unused unbild key
* refactor (context) remove unused imports
* refactor (mentions) update mentions to support items with callback functions and removal of the underlying selection.
* fix (sidebar) add file context as a window that is visitable via the tab key
* refactor (file_content) remove file content as an input to llm
* feat (sidebar) support suggesting and applying code in all languages that are in the context
* feat (sidebar) configurable mapping for removing a file from the context.
* feat (context_view) configure hints for the context view for adding and deleting a file.
* feat (context) add hints for the context view.
* fix (sidebar) type when scrolling the results buffer.
* refactor (selected files) refactor llm stream to accept an array of selected file metadata
* refactor: context => selected_files
---------
Co-authored-by: yetone <yetoneful@gmail.com>