51 Commits

Author SHA1 Message Date
Dmitry Torokhov
5e50db3e05 refactor(file_selector): optimize handling of selected files
Sorting function in FileSelector:get_filepaths() is not very efficient
since it has to hit the filesystem each time it is called to determine
if it is dealing with a directory or not.

Optimize performance by figuring this data in get_project_filepaths()
and returning a list of structures containing paths and directory flags,
and use this data in get_filepaths(). Do the absolute->relative
conversion once.

Also use vim.fn.isdirectory() instead of vim.loop.fs_stat() everywhere
in the file.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
a5a2c22cf7 refactor(file_selector): remove unused argument from process_directory()
FileSelector:process_directory() does not make use of project_root
argument. Remove it and adjust all callers.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
318a45ae08 fix(file_selector): Correct path comparison for selected files
The FileSelector:get_filepaths() function incorrectly filters selected
files due to a mismatch in path formats (relative vs. absolute).

Fix the issue by converting relative file paths to absolute paths before
doing the comparison. Use a set instead of re-scanning the table when
filtering out duplicates.
2025-07-15 16:41:22 +08:00
Dmitry Torokhov
61e38024dc fix(file_selector): avoid converting to relative path twice
get_project_filepath() converts candidate file paths to relative form
twice, once in the first iterator, and then in vim.tbl_map() call while.
It also iterates the same list twice for no apparent reason.

Combine both scans into one and use dedicated vim.fn.isdirectory().
2025-07-15 16:41:22 +08:00
Han Pham
39ac64aca6 feat(file_selector): handle parsing oil directory (#2409) 2025-07-04 21:29:02 +08:00
yetone
e64b5f054c fix: selector preview (#2362) 2025-06-28 20:07:25 +08:00
Avinash Thakur
b52a89cb08 fix: error when adding files where root != cwd (#2233) 2025-06-17 16:08:15 +08:00
Sam Wall
c7edd87820 fix: opening when buffer has scheme path (#2076)
Co-authored-by: Samuel Wall <me@samuelwall.uk>
2025-06-10 23:39:31 +08:00
Sam Wall
860a479789 feat: add terminal buffers to selected files (#2077)
Co-authored-by: Samuel Wall <me@samuelwall.uk>
2025-06-05 01:42:50 +08:00
yetone
c8b075333f feat: use scan_directory util (#2121) 2025-06-03 11:51:58 +08:00
yetone
8f96d4319d fix: relative path (#2023) 2025-05-09 19:57:25 +08:00
yetone
fdcfda7437 fix: types (#1878) 2025-04-15 16:46:29 +08:00
yetone
756d1f1e24 feat: universal selector (#1877) 2025-04-15 16:40:47 +08:00
kyrisu
78d6c389b4 feat: add command to include all buffer files in file selector (#1748) 2025-03-28 10:24:49 +08:00
kyrisu
cfc5a78813 fix: buffer selection logic to include all listed buffers (#1742) 2025-03-27 23:15:14 +08:00
yetone
6e77da83c1 fix: better sidebar (#1603)
* fix: better sidebar

* feat: better msg history

* fix: tests
2025-03-17 01:40:05 +08:00
yetone
3741460541 optimize: make relative (#1529) 2025-03-08 21:15:07 +08:00
Peter Cardenas
afa674c6fd chore: prefer not to use function assignment (#1381) 2025-02-25 12:08:03 +08:00
yetone
e93f2426e9 fix: scan directory (#1362) 2025-02-23 18:26:52 +08:00
LintaoAmons
7a49673023 fix(file_selector): handle absolute and relative filepaths (#1342) 2025-02-23 01:40:27 +08:00
yetone
b04bffa441 fix: types (#1344) 2025-02-22 23:24:20 +08:00
yetone
a6b24f3387 fix: use the current filepath when the filepath of code block cannot be found (#1319) 2025-02-20 16:02:52 +08:00
yetone
09403a26df fix: ignore special buffers (#1307) 2025-02-19 19:25:59 +08:00
Nick Dichev
c1df9970bc feat(file_selector): add @buffers mention to add open buffers to chat context (#1303) 2025-02-19 18:22:07 +08:00
guanghechen
63194b5208 feat(file_selector): support customized filepaths resolver (#1294) 2025-02-18 22:57:59 +08:00
yetone
f8636315a5 fix: get filetype (#1258) 2025-02-12 22:19:55 +08:00
guanghechen
6d116fac36 feat(file_selector): support customized file selector method (#1204) 2025-02-11 13:49:00 +08:00
yetone
29a71b2976 fix: insert conflict contents (#1201) 2025-02-06 22:24:59 +08:00
yetone
f2bd4adba4 feat: add add_file_to_context tool (#1191) 2025-02-06 16:00:14 +08:00
Adam Sherwood
349c5f895c fix: allow single or multi selection with mini.pick. (#1169) 2025-02-03 22:13:37 +08:00
yetone
ec3593aac6 Revert "fix(file_selector): make sure to flatten selected_paths if picker yie…" (#1172) 2025-02-03 22:01:15 +08:00
Aaron Pham
692c168e5b fix(file_selector): make sure to flatten selected_paths if picker yields a single string (#1153) 2025-02-01 09:46:01 -05:00
Michael Gendy
4502e3e1f1 feat (file_selector) Add directory selection support to file selector (#954)
Co-authored-by: yetone <yetoneful@gmail.com>
2025-01-30 18:24:46 +08:00
yetone
0d48b8f8e5 fix(telescope): handle file listing in non-Git repositories 2025-01-25 01:39:09 +08:00
yetone
5b83c48fce fix: file selector handler 2025-01-24 12:52:06 +08:00
yetone
5cf70aab95 fix: lint 2025-01-24 12:52:06 +08:00
Seong Yong-ju
c5d7d542f3 feat(file_selector): add snacks picker as a file selector 2025-01-24 12:52:06 +08:00
yetone
501a138ebc fix: none selection in telescope (#1119) 2025-01-23 11:56:57 +08:00
Fernando Freire
eaf51492d4 fix: proper ft detection with multiple file types in context (#1111) 2025-01-22 11:59:38 +08:00
Adam Sherwood
e4c86e317a feat: add File Selector Provider for mini.pick. (#1107) 2025-01-20 14:38:04 +08:00
yetone
25801daea8 fix: load file content from opened buffer (#1081) 2025-01-15 00:31:24 +08:00
Christopher Brewin
f401983737 feat(sidebar): support files outside of the current working directory. (#1065) 2025-01-11 23:15:13 +08:00
Herschel
6ebba1526b feat(file_selector_fzf): Add multi select for fzf-lua file selector (#1047) 2025-01-07 14:35:24 +08:00
Enes Kutay SEZEN
9895ce7681 feat (file_selector): Add multi select (#971)
* Add multi select

* Remove comment
2025-01-05 17:23:52 +08:00
Rohith Ravi
be92be6124 feat(context): mention @quickfix to add files in qf to context (#988)
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.
2024-12-24 22:48:37 +08:00
Christopher Brewin
8067cb0240 fix(file_selector): empty buffer and chat without file context. (#953) 2024-12-18 19:22:40 +08:00
yetone
4d1447b62f fix: also filter out selected files when using fzf and telescope (#947) 2024-12-13 23:23:16 +08:00
yetone
1516ce093a fix(ci): lua style (#946) 2024-12-13 23:05:44 +08:00
Fernando Freire
5c20cc1779 feat(context): add current buffer to selected file ctx (#941) 2024-12-13 22:57:42 +08:00
Aaron Lifton
a1da07097d feat: allow configurable file select provider (#944)
- add file_selector config
- add providers for fzf and telescope
2024-12-13 22:55:36 +08:00