Commit Graph

1173 Commits

Author SHA1 Message Date
yetone
1e0c8520bc fix: the last used model caused the loss of the model configured in the profile in the model selector (#2600) 2025-08-12 15:33:31 +08:00
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
76fe3f615a refactor(utils): switch debounce() and throttle() to use vim.defer_fn()
vim.defer_fn() does exactly what half of Utils.debounce() and
Utils.throttle() code does, so use it.

While at it add function annotations.
2025-08-12 15:14:37 +08:00
you-n-g
16c58c2e6f fix: update config.lua default value for gpt-5-chat (#2594) 2025-08-12 15:13:44 +08:00
Peter Cardenas
dd151e7f45 fix: allow lazy loading AvanteAskNew (#2598) 2025-08-12 15:13:20 +08:00
brook hong
5a4ed4ac92 feat: add mappings to toggle code window from input in sidebar (#2591) 2025-08-08 20:11:06 +08:00
brook hong
2fc63d4128 feat: toggle code window from result container in sidebar (#2579) 2025-08-06 11:39:38 +08:00
yetone
6bcf7dfbe7 fix: still use str_replace_editor (#2587) 2025-08-06 11:39:13 +08:00
Dmitry Torokhov
70a73d4f98 fix(config): remove last used model data if it is damaged (#2580) 2025-08-05 15:44:13 +08:00
brook hong
6f28f132e5 fix: failed to write correct entry into prompt log file at very begin… (#2581) 2025-08-05 15:19:35 +08:00
yetone
b941cd902d chore: update input height from 6 to 8 (#2582) 2025-08-04 20:55:01 +08:00
brook hong
66cfbb4c19 fix: re-implement prompt logger (#2574)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-03 21:34:38 +08:00
yetone
03f0456d30 fix: add nil check for message before sending notifications 2025-08-02 23:38:21 +08:00
yetone
f475e95eb7 fix: add buffer validation checks in replace_in_file 2025-08-02 17:57:31 +08:00
yetone
657b418c46 fix: check if path is a directory before opening it 2025-08-02 17:53:07 +08:00
PlacidFireball
6d372a9135 fix: set the content property to the empty string (#2566)
Co-authored-by: Jared Weiss <jared.weiss@quiq.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-08-02 15:37:19 +08:00
brook hong
7965546a34 fix: do not ask for API key for bedrock if aws_profile was set (#2564) 2025-08-02 13:00:00 +08:00
yetone
b225094dca fix: breaklines within the content (#2567) 2025-08-02 12:56:20 +08:00
Umut Sahin Onder
6c2a785ebb fix(config): suppress last model info messages if redundant
Only show "Using last model" notification when the loaded model
differs from the original configuration to reduce UI noise
2025-07-31 21:30:41 -07:00
Shogo Nakamoto
ca63356a99 feat: allow overriding bedrock provider endpoint (#2540) 2025-07-31 14:15:34 +08:00
Dmitry Torokhov
5bc4ffa19f refactor(bedrock): replace vim.uv.spawn() with vim.system()
Instead of implementing synchronous call to a command line utility via
vim.uv.spawn() switch to using vim.system(). Its return value (object)
wait() method allows to specify timeout too.

This makes code much simpler.
2025-07-31 14:12:13 +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
skt041959
d77e1272a0 fix: check before set keymap (#2543) 2025-07-30 22:17:28 +08:00
yetone
8c5b3f9706 fix: duplicated replace blocks in diff (#2549) 2025-07-30 22:16:56 +08:00
NekoNekoNiko120
5e4eb8652b feat: remember the last selected model (#2518)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: yetone <yetoneful@gmail.com>
2025-07-28 13:21:49 +08:00
yetone
7e50de8904 fix: ReAct tool use format in few-shot (#2542) 2025-07-28 11:14:45 +08:00
yetone
0a2143586a fix: incorrect json in tool_use example (#2541) 2025-07-28 11:03:01 +08:00
Marcos Romero Lamas
daa419c79b fix: statusline hidden in Avante (#2477) 2025-07-27 14:57:24 +08:00
Peter Cardenas
d8ec4e4aa4 fix: gracefully handle html2md failure (#2533) 2025-07-26 16:19:38 +08:00
Dmitry Torokhov
53dcb55896 fix(sidebar): keep header aligned when sidebar width changed (#2535) 2025-07-26 16:16:23 +08:00
yetone
8bc149ccd8 fix: react prompts (#2537) 2025-07-26 16:06:56 +08:00
Amaury Cannesson
bd69ae14f6 fix(utils): fix gsub in trim_line_numbers() (#2528) 2025-07-24 17:47:10 +08:00
yetone
1452c7233b fix: invalid json format (#2531) 2025-07-24 17:37:10 +08:00
yetone
02aa0a4241 fix: compatible with some incorrect tool results (#2530) 2025-07-24 16:44:05 +08:00
yetone
7af303b421 fix: missing curl error message (#2527) 2025-07-24 16:03:15 +08:00
yetone
ca1271c996 fix: use path instead of target_file in the edit_file input (#2526) 2025-07-24 15:37:26 +08:00
yetone
57311d80ea fix: not enough room (#2525) 2025-07-24 14:33:16 +08:00
yetone
f199625ee4 fix: diff format in k2 v2 (#2524) 2025-07-24 14:31:03 +08:00
yetone
430cac8d91 feat: introduce beast-mode-3.1 (#2523) 2025-07-24 14:16:21 +08:00
yetone
888a49d8c1 fix: bad tool use (#2520) 2025-07-23 23:47:23 +08:00
doodleEsc
faa3945428 feat: implement user-defined text shortcuts (#2512)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-23 11:54:59 +08:00
yetone
8b8a777ec3 fix: typo in prompts (#2517) 2025-07-23 11:50:25 +08:00
yetone
7c9644ceb7 fix: diff format in k2 (#2516) 2025-07-23 11:48:33 +08:00
Dmitry Torokhov
6c9c4365a2 fix(sidebar): do not error when selecting text from help window (#2514) 2025-07-23 11:43:34 +08:00
Joshua Petitma
a72ee55b20 fix: typo (#2513) 2025-07-23 11:42:59 +08:00
yetone
ef29a01840 fix: str_replace (#2515) 2025-07-23 11:06:39 +08:00
yetone
c65604837c fix: diff format (#2510) 2025-07-22 20:38:57 +08:00
Yomi Colledge
f4f82a09d7 fix(llm_tools): Improve the permissions logic (#2506)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-22 17:54:46 +08:00
Dmitry Torokhov
10c0a8d942 feat(sidebar): allow external users identify selected code buffer
External users such as, for example, lualine may want to identify and
add special handling for Avante buffers. This is easily done for Avante
result, input, selected files and todos buffers as they all set a unique
file type. However the selected code buffer inherits file type from the
buffer where the code came from (to have proper syntax highlighting),
and so filetype can not be used to identify it as Avante buffer.

One option would be to add a custom buffer variable, such as
vim.b.avante_buf_type and use it in plugins. Unfortunately lualine
triggers everything on file type, so that would not work.

Solve this by setting file type of the selected code buffer to
"AvanteSelectedCode" and manually activate treesitter parser with
language of the source buffer if treesitter is active there. If the
original code buffer uses legacy syntax highlighting then activate it.
This keeps syntax highlighting active for the code while allowing
external users identify Avante selected code buffer.
2025-07-22 17:50:23 +08:00
Dmitry Torokhov
c6d2783975 fix(sidebar): account for sidebar header on/off for selected code
Current implementation always says that first 5 lines of code is shown
when selected code does not fully fit into its window. This is not
correct as the window can be resized, may have a header occupying one
line, and the lines may not be the first ones. Also the wording is
awkward.

Correct these issues by checking current window height, accounting for
the potential header presence by checking sidebar.enabled config flag,
and updating the message format to be more concise:

" Selected Code (4/15 lines)"

While at it switch to using Utils.count_lines() which does not need
creating temporary tables.

Note that this does not deal with the header info being stale after
resizing sidebar windows.
2025-07-22 17:49:56 +08:00