jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.57k stars 307 forks source link

When using edits command, error when accepting with <C-y> #291

Closed lpleahy closed 9 months ago

lpleahy commented 9 months ago

I am trying to edit some code using ChatGPTEditWithInstructions on a selection of code and it works great up until when I use <C-y> to accept it, at which point I see this:

Error executing lua callback: Vim:E315: ml_get: invalid lnum: 1
stack traceback:
        [C]: in function 'bufload'
        vim/_editor.lua: in function 'region'
        ...ar/neovim/0.9.2/share/nvim/runtime/lua/vim/highlight.lua:35: in function 'range'
        /Users/lpleahy/.local/share/nvim/lazy/markid/lua/markid.lua:90: in function 'highlight_tree'
        /Users/lpleahy/.local/share/nvim/lazy/markid/lua/markid.lua:106: in function 'cb'
        ...2/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:746: in function '_do_callback'
        ...2/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:180: in function 'invalidate'
        ...2/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:887: in function '_on_detach'
        ...r/neovim/0.9.2/share/nvim/runtime/lua/vim/treesitter.lua:73: in function <...r/neovim/0.9.2/share/nvim/runtime/lua/vim/treesitter.lua:69>
        [C]: in function 'nvim_buf_delete'
        ...y/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:292: in function '_buf_destory'
        ...y/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:316: in function 'unmount'
        ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/float.lua:161: in function 'unmount_box'
        ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/float.lua:163: in function 'unmount_box'
        .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:331: in function 'unmount'
        .../.local/share/nvim/lazy/nui.nvim/lua/nui/layout/init.lua:96: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

I am using the latest NVChad changes and am running neovim v0.9.2. All packages have been updated to the latest version.

lpleahy commented 9 months ago

I manually downgraded to neovim 0.9.0 and retried and this started working. Will resolve as this is most likely an issue with NVChad compatibility with neovim 0.9.2

RolandWarburton commented 2 months ago

I am experiencing this same error with the default ChatGPT.nvim configuration on neovim v0.9.5

Following the same instructions and using <C-y> to accept a change throws this error, it then inserts the change anyway.