From 5871cd27fbfe67516731afe1c377ddbed5d538cf Mon Sep 17 00:00:00 2001 From: Dave Mackintosh Date: Mon, 20 May 2024 21:18:00 +0100 Subject: [PATCH] Fix warning in neovim 0.11.x + Closes https://github.com/codota/tabnine-nvim/issues/173 --- lua/tabnine/workspace.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/tabnine/workspace.lua b/lua/tabnine/workspace.lua index 383fd30..1c80835 100644 --- a/lua/tabnine/workspace.lua +++ b/lua/tabnine/workspace.lua @@ -12,7 +12,15 @@ function M.setup() 0, 30000, vim.schedule_wrap(function() - if #vim.lsp.buf_get_clients() > 0 then + local client_count = 0 + + if vim.fn.has('nvim-0.11') == 1 then + client_count = #vim.lsp.get_clients() + else + client_count = #vim.lsp.buf_get_clients() + end + + if client_count > 0 then local root_paths = utils.set(lsp.buf.list_workspace_folders()) tabnine_binary:request({ Workspace = { root_paths = root_paths } }, function() end) end