tzachar / cmp-tabnine

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

Module 'cmp' not found #11

Closed Daniel-Boll closed 2 years ago

Daniel-Boll commented 3 years ago

Summary

Hello, I have encountered an error, my files followed by the error message are shown below.

Files

-- Packer
use {
  "tzachar/cmp-tabnine",
  run = "./install.sh",
  requires = "hrsh7th/nvim-cmp",
  after = "nvim-lspconfig",
  config = function()
     require("custom.plugins.cmp-tabnine.conf").setup()
  end,
}
-- config file
local ok, tabnine = pcall(require, "cmp_tabnine.config")

if not ok then
   return
end

local M = {}
M.setup = function()
   tabnine:setup {
      max_lines = 1000,
      max_num_results = 20,
      sort = true,
      run_on_every_keystroke = true,
      snippet_placeholder = "..",
   }
end

return M

Problem

The error I get opening neovim.

Error executing vim.schedule lua callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:165: Vim(echomsg):E114: Missing quote: "Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nv
im/lua/packer/load.lua:142: Vim(source):E5113: Error while calling lua chunk: ...ite/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/init.lua:1: module 'cmp' not found:

Extra

I also tried to run the install.sh script by hand, but didn't make any difference. Hope someone can help me,

Best Regards.

tzachar commented 3 years ago

You have an error in your packer config.

Error executing vim.schedule lua callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:165: Vim(echomsg):E114: Missing quote: 

try linting you packer config file. It does not look like it is related to cmp-tabnine

Daniel-Boll commented 2 years ago

I manage to make it work, in my config I had to add the after guard on packer use.

use {
  "tzachar/cmp-tabnine",
  run = "./install.sh",
  after = "nvim-cmp", -- Here
  requires = "hrsh7th/nvim-cmp",
  config = function()
     require("custom.plugins.cmp-tabnine.conf").setup()
  end,
}
tzachar commented 2 years ago

Thanks for spotting the problem. I'll update the readme appropriately.