Closed gachikuku closed 8 months ago
@amirbilu this is caused by #156 the expression to calculate the new line number should be:
fn.line(".") + #lines - 2
the current line, plus the number of lines to insert, minus one because the api is 0 indexed, minus one because the current line already exists.
@gachikuku if you change line 29 in ~/.local/share/nvim/lazy/tabnine-nvim/lua/tabnine/completion.lua
to this:
api.nvim_win_set_cursor(0, { fn.line(".") + #lines - 2, fn.col(".") + #lines[#lines] })
does it fix the issue?
Actually it made it worse. Now the error occurs on one line and mulitple lines. Before only on mulitple lines.
api.nvim_win_set_cursor(0, { fn.line("."), fn.col(".") + #lines[#lines] })
fixes it.
Found on #155
Thanks. This is a regression made by a recent PR i merged. Apologies.
@amirbilu I think the difference is in the neovim version. In #155 I'm using v0.10 whereas this issue is in v0.9.5. Perhaps neovim nvim_win_set_cursor
api has changed its behaviour in the new version. Should we use another approach by using nvim_feedkeys
as in copilot?
Or community copilot plugin for neovim written in lua https://github.com/zbirenbaum/copilot.lua/blob/f7612f5af4a7d7615babf43ab1e67a2d790c13a6/lua/copilot/suggestion.lua#L490
@amirbilu I think I found the change on the neovim nvim_buf_set_lines
API affects this behaviour as in https://github.com/codota/tabnine-nvim/issues/155#issuecomment-2000057812. We could continue on #155.
https://github.com/codota/tabnine-nvim/assets/11743804/5dc7abf9-11f4-4be2-98ae-e3d293ee8f00
When I press TAB to complete, the error shown in the video is displayed.
Version Info:
OS: aarch64-apple-darwin
Neovim version : NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377
system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"
Installed Tabnine Binaries: 4.116.0
Active Tabnine Binaries:
no matches found
My tabnine config https://github.com/gachikuku/.dotfiles/blob/main/nvim/.config/nvim/lua/gachikuku/lazy/tabnine.lua
The
dl_binaries.sh
script has been ran manually within the plugin directory~.local/share/nvim/lazy/tabnine-nvim
I could not get it to work by simply including thisbuild = "./dl_binaries.sh"
in my lazyvim config.