bug: the inline suggestion often includes the line itself (in a way that makes accepting the suggestion wrong)
Describe the bug
Basically, the inline suggestions often repeat parts of (or the whole line) and so result in incorrect code when accepted. This does not happen in Cursor (see below).
I've seen it various places and I'm not sure if this is a prompting issue (I use default avantrules) or translating the LLM response into the diff.
To reproduce
Just the default config provided below
Expected behavior
I would expect the provided suggestion to be syntactically correct (and not repeat the full/partial line).
Installation method
{ -- avante (AI code assistant)
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest change
opts = {
provider = "claude",
auto_suggestions_provider = "claude",
claude = {
endpoint = "https://api.anthropic.com",
model = "claude-3-5-sonnet-20241022",
temperature = 0,
max_tokens = 4096,
},
behaviour = {
auto_suggestions = true,
auto_set_highlight_group = true,
auto_set_keymaps = true,
auto_apply_diff_after_generation = false,
support_paste_from_clipboard = false,
},
mappings = {
diff = {
ours = "co",
theirs = "ct",
all_theirs = "ca",
both = "cb",
cursor = "cc",
next = "]x",
prev = "[x",
},
suggestion = {
accept = "<M-l>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
jump = {
next = "]]",
prev = "[[",
},
submit = {
normal = "<CR>",
insert = "<C-s>",
},
sidebar = {
apply_all = "A",
apply_cursor = "a",
switch_windows = "<Tab>",
reverse_switch_windows = "<S-Tab>",
},
},
hints = { enabled = false },
windows = {
position = "smart", -- the position of the sidebar
wrap = true, -- similar to vim.o.wrap
width = 30, -- default % based on available width
sidebar_header = {
enabled = true, -- true, false to enable/disable the header
align = "center", -- left, center, right for title
rounded = true,
},
input = {
prefix = "» ",
},
edit = {
border = "rounded",
start_insert = true, -- Start insert mode when opening the edit window
},
ask = {
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
start_insert = true, -- Start insert mode when opening the ask window, only effective if floating = true.
border = "rounded",
},
},
highlights = {
diff = {
current = "DiffText",
incoming = "DiffAdd",
},
},
diff = {
autojump = true,
list_opener = "copen",
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
Environment
NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382 Run "nvim -V1 -v" for more info
MacOS
Repro
No response
I'm observing the same error. It happens frequently, but not 100% of the time -- maybe 4 out of every 5 autocompletes display this bug
How do you get it in the first place? I don't have any inline hints at all practically having the same config file. I can chat and edit selected code though.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I'm still observing the same error
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.