From 79523cb8969438c8358c0472a92609e5d87b8850 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 15 Jan 2025 18:35:06 +0800 Subject: [PATCH] fix: refine suggestion prompts --- lua/avante/suggestion.lua | 2 ++ lua/avante/templates/suggesting.avanterules | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/avante/suggestion.lua b/lua/avante/suggestion.lua index 579c58ef0..8552653dd 100644 --- a/lua/avante/suggestion.lua +++ b/lua/avante/suggestion.lua @@ -213,6 +213,8 @@ function Suggestion:show() local suggestions = ctx.suggestions_list and ctx.suggestions_list[ctx.current_suggestions_idx] or nil + Utils.debug("show suggestions", suggestions) + if not suggestions then return end for _, suggestion in ipairs(suggestions) do diff --git a/lua/avante/templates/suggesting.avanterules b/lua/avante/templates/suggesting.avanterules index 602aad502..11abe78eb 100644 --- a/lua/avante/templates/suggesting.avanterules +++ b/lua/avante/templates/suggesting.avanterules @@ -32,8 +32,8 @@ Your task is to suggest code modifications at the cursor position. Follow these {% endraw %} JSON fields explanation: - start_row: The starting row of the code snippet you want to replace (1-indexed), inclusive - end_row: The ending row of the code snippet you want to replace (1-indexed), inclusive + start_row: The starting row of the code snippet you want to replace, start from 1, inclusive + end_row: The ending row of the code snippet you want to replace, start from 1, inclusive content: The suggested code you want to replace the original code with Guidelines: @@ -52,4 +52,5 @@ Guidelines: 13. If there are no recommended modifications, return an empty list. 14. Remember to ONLY RETURN the suggested code snippet, without any additional formatting or explanation. 15. The returned code must satisfy the context, especially the context where the current cursor is located. + 16. Each line in the returned code snippet is complete code; do not include incomplete code. {% endblock %}