tzachar / cmp-tabnine

TabNine plugin for hrsh7th/nvim-cmp
MIT License
287 stars 28 forks source link

Platform identification seems off for intel macs #52

Closed jasmith79 closed 2 years ago

jasmith79 commented 2 years ago

Intel MacBook Air 2020 running Big Sur Neovim 0.7.0 nvim-cmp cmp-tabnine

Attempting to run the plugin (installed with vim plug) I got the following error:

Error detected while processing /Users/jsmith/.vim/plugged/cmp-tabnine/after/plugin/cmp-tabnine.lua:
E5113: Error while calling lua chunk: Vim:E475: Invalid value for argument cmd: '/Users/jsmith/.vim/plugged/cmp-tabnine/binaries/4.4.21/-apple-darwin/TabNine' is not executable
stack traceback:
        [C]: in function 'jobstart'
        ...mith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:175: in function '_on_exit'
        ...mith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:98: in function 'new'
        ...jsmith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/init.lua:7: in function 'setup'
        ...th/.vim/plugged/cmp-tabnine/after/plugin/cmp-tabnine.lua:1: in main chunk

Tracing out the file path to see if maybe it was just an issue of not having the executable bit set, I realized the path to the binary was missing the platform architecture, i.e. should be $HOME/.vim/plugged/cmp-tabnine/binaries/4.4.21/x86_64-apple-darwin/TabNine but the x86_64 was missing. I was able to "fix" the problem by hardcoding it in source.lua and now everything seems to work ok but I'm afraid I don't know lua or how it interfaces with the OS well enough to submit a fix.

tzachar commented 2 years ago

what is the output of uname -m on your laptop?

jasmith79 commented 2 years ago

x86_64, which is why I don't understand why the fn.system call seems to be returning an empty string. I guess the arch .. '-apple-darwin' line could be changed to just 'x86_64-apple-darwin' the way the code does for the new ARM macs. Last macs that didn't have 64bit chips came out over a decade ago (and the PowerPC models even longer), I don't know how much legacy support this project aims at providing.