diff --git a/lua/tabnine/workspace.lua b/lua/tabnine/workspace.lua index 8b2d7c4..383fd30 100644 --- a/lua/tabnine/workspace.lua +++ b/lua/tabnine/workspace.lua @@ -1,16 +1,21 @@ local tabnine_binary = require("tabnine.binary") -local fn = vim.fn local uv = vim.loop +local lsp = vim.lsp +local utils = require("tabnine.utils") local M = {} function M.setup() local timer = uv.new_timer() + timer:start( 0, 30000, vim.schedule_wrap(function() - tabnine_binary:request({ Workspace = { root_paths = { fn.getcwd() } } }, function() end) + if #vim.lsp.buf_get_clients() > 0 then + local root_paths = utils.set(lsp.buf.list_workspace_folders()) + tabnine_binary:request({ Workspace = { root_paths = root_paths } }, function() end) + end end) ) end