Skip to content

Commit 1172946

Browse files
authored
workspace from lsp (#159)
1 parent 4cfd94f commit 1172946

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lua/tabnine/workspace.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
local tabnine_binary = require("tabnine.binary")
2-
local fn = vim.fn
32
local uv = vim.loop
3+
local lsp = vim.lsp
4+
local utils = require("tabnine.utils")
45

56
local M = {}
67

78
function M.setup()
89
local timer = uv.new_timer()
10+
911
timer:start(
1012
0,
1113
30000,
1214
vim.schedule_wrap(function()
13-
tabnine_binary:request({ Workspace = { root_paths = { fn.getcwd() } } }, function() end)
15+
if #vim.lsp.buf_get_clients() > 0 then
16+
local root_paths = utils.set(lsp.buf.list_workspace_folders())
17+
tabnine_binary:request({ Workspace = { root_paths = root_paths } }, function() end)
18+
end
1419
end)
1520
)
1621
end

0 commit comments

Comments
 (0)