yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
6.66k stars 240 forks source link

fix(save): schedule save within a loop #560

Closed leiserfg closed 3 weeks ago

leiserfg commented 1 month ago

Fixes #559

leiserfg commented 1 month ago

The error comes from the fact that save() calls history.get, which then calls vim.nvim_buf_get_name which needs to be scheduled because it can't runt in the loop.

leiserfg commented 1 month ago

I'm not sure why delaying save a few milliseconds will be a problem.

leiserfg commented 1 month ago

Hi @aarnphm can you please help me with this?

Lap1n commented 1 month ago

Looks like this proposed fix is the way it was suggested in this other closed issue on plenary repo. Didn't review the codebase yet, but maybe it is because save is called in a lua callback

yetone commented 1 month ago

This fix looks fine.