43 Commits

Author SHA1 Message Date
Dmitry Torokhov
638d237b75 refactor(utils): make prepend_line_numbers() more efficient and idiomatic
Between Utils.prepend_line_number() and its only caller, there is a lot
of conversions from list to string to list and back to string. Simplify
all of this by making it accept and return a list of strings, which
avoids unnecessary splitting and joining.

The implementation was updated to use vim.iter():map() and
string.format() for better performance and to align with the idiomatic
functional style used elsewhere in the project.

The name of the function has also been tweaked and is now
"prepend_line_numbers()" to better reflect that it operates on a list of
strings.

The caller has been updated to match the new function signature.
2025-08-12 15:14:37 +08:00
Dmitry Torokhov
d737fa6109 build: remove presubmit dependency on luvit-meta
As discussed in https://github.com/yetone/avante.nvim/pull/2536 the
project should either use luv bindings from luals or luvit-meta
library, but not both, as they conflict with each other (especially
with uv.uv_timer_t). Given that other projects such as kickstart.nvim
and lazydev.nvim are switching to use the former, we should do the same
and drop luvit-meta dependency.

Also adjust code that was using luvit-meta's annotations for timers.
2025-07-31 14:12:13 +08:00
Dmitry Torokhov
aa606b6147 refactor(history): change HistoryMessage:new() to accept role and item
Change the constructor to accept role and a single content item instead
of raw AvanteLLMMessage instance. This will help when we will start
changing message.content from being a string or a list of tables to just
a string or a single table.
2025-07-22 17:49:28 +08:00
Dmitry Torokhov
34907fc1cd refactor(history): start moving history-related code into avante/history
The utils module has grown too big and contains unrelated functionality.
Start moving code related to managing history messages comprising chat
history into lua/avante/history module to keep the code more manageable.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
80f50af6fb Some refactors in suggestion.lua (#2443) 2025-07-14 10:05:03 +08:00
yetone
102197c5bb fix: debounce error (#2337) 2025-06-26 15:38:57 +08:00
yetone
6e1e2ac9f2 feat: automatically obtain diagnostics after finishing editing the file (#2018) 2025-05-08 22:50:46 +08:00
yetone
4cb4f34fed fix: suggestion history messages (#1993) 2025-05-06 19:49:34 +08:00
yetone
32ca1ed38e fix: set default auto suggestions provider to nil (#1951) 2025-05-01 02:50:01 +08:00
yetone
7e31317fbc fix(lint): make neovim 0.11 typecheck happy (#1844) 2025-04-10 14:14:47 +08:00
yetone
a9b01e766e chores: use stopinsert (#1745) 2025-03-28 00:17:01 +08:00
yetone
39787969c7 fix: memory (#1718) 2025-03-26 00:45:54 +08:00
yetone
0d592f440c Revert "refactor: message content (#1424)" (#1442)
This reverts commit ae8497faf1.
2025-03-01 13:25:51 +08:00
yetone
5bb055795f feat(suggestions): add tags around json (#1441) 2025-03-01 13:11:12 +08:00
yetone
ae8497faf1 refactor: message content (#1424) 2025-02-28 14:43:39 +08:00
Thomas Müller
63136fd92f fix(suggestions): make history more faithful to future input (#1210)
* fix(suggestions): make history more faithful to future input

* fix(suggestions): put cursor to the end of line in suggestion history
2025-02-11 02:08:58 +08:00
yetone
faa6728d4b fix: try to fix suggestions (#1209) 2025-02-07 16:26:35 +08:00
yetone
1437f319d2 feat: tools (#1180)
* feat: tools

* feat: claude use tools

* feat: openai use tools
2025-02-05 22:39:54 +08:00
yetone
b6d4180bb6 fix: suggestion ui (#1108) 2025-01-20 23:45:16 +08:00
yetone
fdbd5ed1d8 fix: cleanup the empty suggestion (#1105) 2025-01-19 17:28:42 +08:00
yetone
da4ef9d9e9 fix: suggetion in the middle of line (#1094) 2025-01-16 21:39:11 +08:00
yetone
ac6bf35616 feat: include diagnostics in suggestion (#1093) 2025-01-16 21:29:14 +08:00
yetone
0df03dd213 fix: refine suggestion prompts (#1087) 2025-01-15 18:35:36 +08:00
yetone
24cb3f8e19 fix: suggestions transfroming (#1080) 2025-01-15 00:06:49 +08:00
yetone
bd8afce3b0 feat: tab flow (#1077) 2025-01-14 15:39:57 +08:00
yetone
24641d8264 refactor: new prompts structure (#1071) 2025-01-11 23:09:55 +08:00
Ethan Howard
c3e7ba0be0 feat: respect git ignore for autosuggestions (#994) 2025-01-11 23:00:19 +08:00
Michael Gendy
e98fa46bec feat(tokens): add token count display to sidebar (#956)
* feat (tokens) add token count display to sidebar

* refactor: calculate the real tokens and reuse input hints to avoid occlusion

---------

Co-authored-by: yetone <yetoneful@gmail.com>
2024-12-17 20:43:25 +08:00
Christopher Brewin
78dd9b0a6d feat(context): add a ui for selecting and adding files to the sidebar as context (#912)
* 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>
2024-12-12 01:29:10 +08:00
Radosław Woźniak
97f04f87f5 fix(suggestions): cleanup response to ensure JSON (#900)
LLM is not always smart enough to follow the prompt
2024-11-25 20:26:59 +08:00
Changmin Choi
08bed9e256 Handle backticks before decoding JSON (#683)
* feat: Clean up full_response before JSON decoding

* fix: make backtick matching more accurate
2024-10-08 16:13:56 +08:00
yetone
22243bc316 feat: silence debug msg (#636) 2024-09-26 11:18:40 +08:00
yetone
8e1018fef7 feat: repo map (#496)
* feat: repo map

* chore: remove breakline

* chore: remove spaces

* fix: golang public method

* feat: mentions for editing input
2024-09-23 18:52:26 +08:00
yetone
0642905c80 feat: specific provider for auto-suggestions (#569) 2024-09-12 14:23:00 +08:00
yetone
7532e590d2 fix: suggestion instantiate (#554) 2024-09-08 17:17:52 +08:00
Aaron Pham
7015dde5bf chore(mapping): add support for toggling suggestion (#546)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-06 01:09:02 -04:00
Aaron Pham
29e109e447 feat(api): support native chat mode (#541)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-05 02:43:31 -04:00
Aaron Pham
d7d476ddf5 chore(secrets): support table of string (#500)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-03 21:47:01 -04:00
yetone
9765eaca21 chore(suggestion): increase debounce delay (#472) 2024-09-03 17:18:38 +08:00
Aaron Pham
0d8098e4eb fix(style): add parentheses (#471)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-03 05:12:07 -04:00
Aaron Pham
e8c71d931e chore: run stylua [generated] (#460)
* chore: add stylua

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

* chore: running stylua

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>

---------

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-03 04:19:54 -04:00
Aaron Pham
4ad913435c feat(templates): avanterules filetype support (closes #254) (#466)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
2024-09-03 04:09:13 -04:00
yetone
65e1e178f5 feat: automatic suggestion (smart tab) (#455) 2024-09-03 14:03:59 +08:00