Closed hrqmonteiro closed 3 years ago
Make sure you call the compe plugin b4 the tabnine one and also setup compe b4 configuring tabnin.
Also, the error you report looks like to be coming from within you own configuration. So unless you share something there's not much I can do to help u.
Compe is called before compe-tabnine:
And i am calling the line on the last line of my compe.lua
file on purpose now so the compe setup is done before it:
local protocol = require "vim.lsp.protocol"
vim.o.completeopt = "menuone,noselect"
local remap = vim.api.nvim_set_keymap
local npairs = require('nvim-autopairs')
local exec = vim.api.nvim_exec
require "compe".setup {
enabled = true,
debug = false,
min_length = 1,
preselect = "disable",
source_timeout = 200,
-- incomplete_delay = 400,
allow_prefix_unmatch = false,
documentation = true,
source = {
path = {menu = ""},
buffer = {menu = ""},
vsnip = {menu = ""},
nvim_lsp = {menu = ""},
nvim_lua = {menu = ""},
treesitter = {menu = "滑"},
spell = true,
calc = true,
tags = true
-- omni = true
}
}
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col(".") - 1
if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
return true
else
return false
end
end
-- Use (s-)tab to:
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
_G.tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-n>"
elseif vim.fn.call("vsnip#available", {1}) == 1 then
return t "<Plug>(vsnip-expand-or-jump)"
elseif check_back_space() then
return t "<Tab>"
else
return vim.fn['compe#complete']()
end
end
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
return t "<Plug>(vsnip-jump-prev)"
else
return t "<S-Tab>"
end
end
_G.MUtils= {}
vim.g.completion_confirm_key = ""
MUtils.completion_confirm=function()
if vim.fn.pumvisible() ~= 0 then
if vim.fn.complete_info()["selected"] ~= -1 then
vim.fn["compe#confirm"]()
return npairs.esc("<c-y>")
else
vim.defer_fn(function()
vim.fn["compe#confirm"]("<cr>")
end, 20)
return npairs.esc("<c-n>")
end
else
return npairs.check_break_line_char()
end
end
remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
remap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
remap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
remap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
remap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
exec(
[[
let g:compe.source.tabnine = v:true
]], "")
And it still causing the same error:
Also, the install.sh
runs normally if i do it again:
$ ./.local/share/nvim/site/pack/paqs/start/compe-tabnine/install.sh
++ curl -sS https://update.tabnine.com/version
+ version=3.2.28
+ case $(uname -s) in
++ uname -s
+ platform=unknown-linux-gnu
++ uname -m
+ triple=x86_64-unknown-linux-gnu
++ dirname ./.local/share/nvim/site/pack/paqs/start/compe-tabnine/install.sh
+ cd ./.local/share/nvim/site/pack/paqs/start/compe-tabnine
+ path=3.2.28/x86_64-unknown-linux-gnu/TabNine
+ [[ -f binaries/3.2.28/x86_64-unknown-linux-gnu/TabNine ]]
++ uname -s
+ [[ -e binaries/TabNine_Linux ]]
++ uname -s
+ ln -sf 3.2.28/x86_64-unknown-linux-gnu/TabNine binaries/TabNine_Linux
+ exit
you should initialize tabnine as ou do all the internal source:
require "compe".setup {
enabled = true,
debug = false,
min_length = 1,
preselect = "disable",
source_timeout = 200,
-- incomplete_delay = 400,
allow_prefix_unmatch = false,
documentation = true,
source = {
path = {menu = ""},
buffer = {menu = ""},
vsnip = {menu = ""},
nvim_lsp = {menu = ""},
nvim_lua = {menu = ""},
treesitter = {menu = "滑"},
spell = true,
calc = true,
tags = true,
tabnine = true
}
}
@tzachar I added tabnine = {kind = "", priority=200, max_num_results=3}
to my config and TabNine never starts up. Here is my entire compe config.
local M = {}
M.config = function()
require "compe".setup {
enabled = true,
autocomplete = true,
debug = true,
min_length = 1,
preselect = "enable",
throttle_time = 80,
source_timeout = 200,
incomplete_delay = 400,
max_abbr_width = 100,
max_kind_width = 100,
max_menu_width = 100,
documentation = true,
source = {
path = {kind = " "},
buffer = {kind = "", true},
luasnip = {kind = " ", true},
nvim_lsp = true,
nvim_lua = true,
tabnine = {kind = "", priority=200, max_num_results=3}
}
}
end
M.snippets = function()
local ls = require("luasnip")
ls.config.set_config(
{
history = true,
updateevents = "TextChanged,TextChangedI"
}
)
require("luasnip/loaders/from_vscode").load()
end
return M
I installed the plugin, and it ran the
install.sh
script.But when i try to set it on my configs, i got this error when i open nvim.