Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash for any action with latest version of nvim #29

Open
prabhakarjuzgar opened this issue Mar 17, 2024 · 2 comments
Open

crash for any action with latest version of nvim #29

prabhakarjuzgar opened this issue Mar 17, 2024 · 2 comments

Comments

@prabhakarjuzgar
Copy link

Error executing vim.schedule lua callback: ...r/.local/share/nvim/lazy/ollama.nvim/lua/ollama/init.lua:173: start_col must be less than end_col
stack traceback:
[C]: in function 'nvim_buf_get_text'
...r/.local/share/nvim/lazy/ollama.nvim/lua/ollama/init.lua:173: in function 'parse_prompt'
...r/.local/share/nvim/lazy/ollama.nvim/lua/ollama/init.lua:249: in function 'callback'
...r/.local/share/nvim/lazy/ollama.nvim/lua/ollama/init.lua:205: in function 'cb'
...ocal/share/nvim/lazy/dressing.nvim/lua/dressing/util.lua:203: in function <...ocal/share/nvim/lazy/dressing.nvim/lua/dressing/util.lua:202>
Press ENTER or type command to continue

@mclarkson
Copy link

I got this as well. Code needs to be selected first.

@yamsergey
Copy link

yamsergey commented Apr 23, 2024

I've faced similar issue (not the same though) and tried to debug, it leads me to this line

vim.api.nvim_buf_set_text(bufnr, start_line, start_col, end_line, end_col, lines)

It was my first experience with lua, but seems that vim.api.nvim_buf_set_text is a bit fragile, and might be not the best choice when number of lines doesn't match for original and suggested text. I ended up by replacing it with:

    vim.api.nvim_buf_set_lines(bufnr, start_line, end_line, false, {})
    vim.api.nvim_buf_set_lines(bufnr, start_line, start_line, false, lines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants