Commit Graph

196 Commits

Author SHA1 Message Date
XuJiawei
42028811e4 refine: replace vim.fn.system with vim.system (#2863) 2025-12-13 18:58:10 +08:00
yetone
159b452426 chore: replace replace_in_file references with str_replace (#2811) 2025-10-31 02:08:53 +08:00
Alan
4286ac963a fix(utils): ensure empty tool properties encode as JSON object (#2803)
When tools have no parameters, llm_tool_param_fields_to_json_schema
returns an empty Lua table {}. vim.json.encode serializes empty tables
as JSON arrays [] instead of objects {}, causing Anthropic API to reject
requests with "tools.N.custom.input_schema.properties: Input should be
a valid dictionary" error.

Solution: Use vim.empty_dict() for empty properties to ensure correct
JSON object {} serialization instead of array [].

Tested with Claude Sonnet 4.5 - tools now work correctly without
schema validation errors.
2025-10-30 13:21:47 +08:00
yetone
fb28520067 Refine buffer updates and tool call metadata (#2784) 2025-10-20 13:58:34 +08:00
yetone
0971d8f421 fix: stabilize ACP streaming updates (#2776) 2025-10-16 21:28:45 +08:00
yetone
487972386e feat: support acp slash commands (#2775) 2025-10-16 19:05:57 +08:00
Dmitry Torokhov
4fc83dc308 cleanup: use vim.uv instead of vim.loop everywhere (#2762) 2025-10-15 18:44:40 +08:00
Carlos Gomes
56951378f1 feat: include hidden files when scanning directories (#2700) 2025-09-11 21:44:14 +08:00
yetone
10e0312ec4 feat: request permission button group (#2685) 2025-09-04 15:35:40 +08:00
yetone
4ac4c8ed3f feat(ui): expand tool use message (#2684) 2025-09-04 00:17:32 +08:00
yetone
7c4f88606c fix: full view width (#2662) 2025-08-31 23:02:42 +08:00
brook hong
604fdcc4b1 feat: add project root option in commands Ask/Chat/ChatNew (#2659) 2025-08-31 22:10:29 +08:00
yetone
bcbe0347d8 feat: supports full view in multi-window mode (#2660) 2025-08-31 21:33:57 +08:00
yetone
ff116a5673 feat: add full_view_ask api (#2658) 2025-08-31 19:17:20 +08:00
yetone
5e0aa7e5c0 feat: support acp (#2649) 2025-08-31 07:41:19 +08:00
忍野ペンギン
8a2ed691c0 fix: handle is already closing (#2613)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-08-24 16:21:55 +08:00
brook hong
c1ccb7867a fix: remove trailing spaces each line when editing files (#2612) 2025-08-16 14:16:38 +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
yetone
03f0456d30 fix: add nil check for message before sending notifications 2025-08-02 23:38:21 +08:00
yetone
b225094dca fix: breaklines within the content (#2567) 2025-08-02 12:56:20 +08:00
yetone
8c5b3f9706 fix: duplicated replace blocks in diff (#2549) 2025-07-30 22:16:56 +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
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
0490927061 fix: edit_file is an edit tool 2025-07-21 11:14:19 +08:00
Dmitry Torokhov
2335ea3d15 refactor(history): reduce computational complexity when handling history
When updating chat history to be used in LLM request there are several
instances where we do O(n^2) operations: scanning all messages to locate
a tool "use" and for each use scan messages again to locate
corresponding "result".

Refactor the code to scan messages once collecting tool uses and results
together, and then do 2nd scan to drop incomplete tool invocations and
refresh "view" and "edit" results with the latest content.

Also reduce number of pre-scan loops (where we discard partially
generated messages or messages that are not interesting or too-old) by
combining them when possible.

This reduces time to scan initial 417 messages on my system (which
result in 576 final messages) from 0.32 to 0.12 seconds.
2025-07-18 22:36:21 -07:00
yetone
adbd296ba6 feat: integrated morph 2025-07-16 18:34:52 +08:00
Dmitry Torokhov
966eef743b refactor(history): move message rendering into history module
Move code related to converting history messages into UI representation
from utils into history/render.lua for better code organization and
clean up the implementation.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
06d9d8cec3 refactor(utils): remove history_messages_to_messages() function
Utils.history_messages_to_messages() is not used anywhere, remove it.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
d7c48075a5 refactor(history): move code collecting pending tools to history
Code dealing with scanning history messages and extracting some data or
state belongs to avante/history/ so move it there. Along with the move
update the implementation to make use of get_tool_use_data() and
get_tool_result_data() helpers to simplify it.

Also rename the function to History.get_pending_tools() to better
reflect its purpose: "uncalled" means something that was done without
request, unsolicited, not something that has not completed yet.
2025-07-16 12:49:15 +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
yetone
127a12a878 fix: trim escapes for write_to_file tool (#2455) 2025-07-16 12:04:22 +08:00
yetone
154e5f578f feat: add timeout for bash tool (#2451) 2025-07-15 20:46:15 +08:00
Dmitry Torokhov
d3dde0c5ff refactor(utils): simplify and annotate count_lines() (#2446) 2025-07-15 16:42:30 +08:00
yetone
b8bb0fd969 refactor: llm tool parameters (#2449) 2025-07-15 16:40:25 +08:00
Arnon Keereena
a78af4ce99 Fix bugs where the file picker windows disappear on @file mentions (#2442)
Co-authored-by: Arnon Keereena <arnon.keereena@accenture.com>
2025-07-14 10:08:55 +08:00
Dmitry Torokhov
80f50af6fb Some refactors in suggestion.lua (#2443) 2025-07-14 10:05:03 +08:00
yetone
c0249db33d fix: call a slow function in a fast event context (#2424) 2025-07-08 19:54:21 +08:00
yetone
17a1f83950 fix: trim slashes (#2399) 2025-07-03 00:30:58 +08:00
yetone
203861bb71 feat: init project (#2395) 2025-07-02 18:44:30 +08:00
yetone
e64b5f054c fix: selector preview (#2362) 2025-06-28 20:07:25 +08:00
yetone
7738503c1d fix: open buffer (#2340) 2025-06-26 16:52:23 +08:00
yetone
102197c5bb fix: debounce error (#2337) 2025-06-26 15:38:57 +08:00
yetone
ad8b24e3bc fix: tool_use prompt (#2332) 2025-06-25 20:14:45 +08:00
Peter Cardenas
9a04edba4a chore: remove all references to nvim-treesitter (#2327) 2025-06-25 17:42:38 +08:00
yetone
07b703dbd5 fix: ReAct parser (#2330) 2025-06-25 16:55:10 +08:00
Peter Cardenas
6a75590c48 fix: error when editing a modified buffer (#2318) 2025-06-24 19:16:57 +08:00
yetone
c48808b4a8 fix: tool logs rendering (#2315) 2025-06-24 11:00:26 +08:00
yetone
e7113f1834 optimize: use cache to optimize the performance of streaming rendering (#2312) 2025-06-24 02:06:50 +08:00