Coder Social home page Coder Social logo

How to install in NvChad? about cmp-tabnine HOT 11 CLOSED

tzachar avatar tzachar commented on June 14, 2024
How to install in NvChad?

from cmp-tabnine.

Comments (11)

siduck avatar siduck commented on June 14, 2024 9

author of nvchad here. i'd suggest using this as it doesnt load the plugin at startup.
@ansidev

{
    "hrsh7th/nvim-cmp",
    opts = {
      sources = {
        { name = "nvim_lsp" },
        { name = "luasnip" },
        { name = "buffer" },
        { name = "nvim_lua" },
        { name = "path" },
        { name = "cmp_tabnine" },
      },
    },

    dependencies = {
      {
        "tzachar/cmp-tabnine",
        build = "./install.sh",
        config = function()
          local tabnine = require "cmp_tabnine.config"
          tabnine:setup {} -- put your options here
        end,
      },
    },
},

from cmp-tabnine.

shanestillwell avatar shanestillwell commented on June 14, 2024 4

FWIW. This is how I got TabNine working in NvChad

custom/plugins/init.lua

return {
  ["tzachar/cmp-tabnine"] = {
    after = "nvim-cmp",
    run = "./install.sh",
    config = function()
      require "custom.plugins.configs.tabnine"
    end,
  },
}

custom/plugins/configs/tabnine.lua

local present, cmp = pcall(require, "cmp")

if not present then
   return
end

local sources = {
  { name = 'cmp_tabnine' },
}

cmp.setup {
   sources = sources,
}

from cmp-tabnine.

ansidev avatar ansidev commented on June 14, 2024 2

My config for NvChad v2.0

File: lua/custom/plugins.lua

  {
    "tzachar/cmp-tabnine",
    lazy = false,
    dependencies = "hrsh7th/nvim-cmp",
    build = "./install.sh",
    config = function()
      require("cmp").setup {
        sources = {
          { name = 'cmp_tabnine' },
        },
      }
      require('cmp_tabnine.config').setup {
        max_lines = 1000,
        max_num_results = 20,
        sort = true,
        run_on_every_keystroke = true,
        snippet_placeholder = '..',
        show_prediction_strength = false
      }
    end,
  },

from cmp-tabnine.

tzachar avatar tzachar commented on June 14, 2024

Never used NvChad. But one issue that comes to mind is that you need to run the install.sh script.
No Idea how to do that in NvChad.
You can also call the install.sh script by hand once, which will solve the issue.

from cmp-tabnine.

JasonDorn avatar JasonDorn commented on June 14, 2024

My setup appears to not be able to hook into tabnine at all.
image
When I run: :CmpStatus I can see that it's ready

When I run: LspInfo i get:
image

But when I check Packer:
image

I can see it's installed properly.

Does anyone know how I can get cmp to load my tab nine data?

Even my Tabnine hub seems to be picking up my sources and everything
image

from cmp-tabnine.

tzachar avatar tzachar commented on June 14, 2024

Did you add cmp_tabnine to cmp's sources list?

from cmp-tabnine.

JasonDorn avatar JasonDorn commented on June 14, 2024

I believe so, I assume that's why it's available in my first screen shot when I run :CmpStatus ๐Ÿค”

It almost feels like it gets picked up by cmp but not wired up to the lsp client itself.

The one language client that seems to get picked up by my LSP client is:

lspconfig.sumneko_lua.setup {
  on_attach = M.on_attach,
  capabilities = M.capabilities,

  settings = {
    Lua = {
      diagnostics = {
        globals = { "vim" },
      },
      workspace = {
        library = {
          [vim.fn.expand "$VIMRUNTIME/lua"] = true,
          [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
        },
        maxPreload = 100000,
        preloadFileSize = 10000,
      },
    },
  },
}

because if have this config. I'm trying to figure out how to do the same for:

lspconfig.cmp_tabnine.setup {
  on_attach = M.on_attach,
  capabilities = M.capabilities,
}

This is my compiled packer file:

  ["cmp-tabnine"] = {
    after_files = { "/Users/jasondorn/.local/share/nvim/site/pack/packer/opt/cmp-tabnine/after/plugin/cmp-tabnine.lua" },
    config = { "\27LJ\2\ni\0\0\1\0\1\0\0025\0\0\0L\0\2\0\1\0\5\29show_prediction_strength\1\27run_on_every_keystroke\2\20max_num_results\3\5\14max_lines\3รจ\a\tsort\2\0" },
    load_after = {
      ["nvim-cmp"] = true
    },
    loaded = false,
    needs_bufread = false,
    path = "/Users/jasondorn/.local/share/nvim/site/pack/packer/opt/cmp-tabnine",
    url = "https://github.com/tzachar/cmp-tabnine"
  },

Seems to load everything properly?

New Error:

image

from cmp-tabnine.

tzachar avatar tzachar commented on June 14, 2024

I don't know why you keep bringing up LSP. TabNine does not interface into any LSP, but operates on its own.
This plugin only plugs TabNine into cmp.
You need to remove all LSP config which references tabnine.
Anyway, I was asking if you added cmp_tabnine as a source for cmp

from cmp-tabnine.

JasonDorn avatar JasonDorn commented on June 14, 2024

Sorry, newer to these configs, trying to make sense of it all.

I did!

  sources = {
    { name = "luasnip" },
    { name = "nvim_lsp" },
    { name = "buffer" },
    { name = "nvim_lua" },
    { name = "path" },
    { name = "cmp_tabnine"}
  },

Running :CmpStatus yields:
image
So I believe it's ready to be used? My issue is probably less with your work and why my nvim-lsp isn't picking up on my cmp configs

from cmp-tabnine.

tzachar avatar tzachar commented on June 14, 2024

Again, nvim lsp is not connected to cmp. Its the other way around.
cmp will use nvim_lsp to get completion from the running lsp.

from cmp-tabnine.

tzachar avatar tzachar commented on June 14, 2024

You should call setup with a :

require('cmp_tabnine.config'):setup

from cmp-tabnine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.