hrsh7th / cmp-nvim-lsp

nvim-cmp source for neovim builtin LSP client
MIT License
1.24k stars 48 forks source link

Unknown Source Names - nvim_lsp #27

Closed yerttle closed 2 years ago

yerttle commented 2 years ago

Hi there, I am struggling to install the plugin and have tried a few differnet ways. Each time if I run :CmpStatus the nvim_lsp plugin is listed as an unknown source.

local on_windows = vim.loop.os_uname().version:match 'Windows'

local function join_paths(...)
  local path_sep = on_windows and '\\' or '/'
  local result = table.concat({ ... }, path_sep)
  return result
end

vim.cmd [[set runtimepath=$VIMRUNTIME]]

local temp_dir = vim.loop.os_getenv 'TEMP' or '/tmp'

vim.cmd('set packpath=' .. join_paths(temp_dir, 'nvim', 'site'))

local package_root = join_paths(temp_dir, 'nvim', 'site', 'pack')
local install_path = join_paths(package_root, 'packer', 'start', 'packer.nvim')
local compile_path = join_paths(install_path, 'plugin', 'packer_compiled.lua')

local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      'neovim/nvim-lspconfig',
      'hrsh7th/cmp-nvim-lsp',
      'hrsh7th/nvim-cmp',
      'hrsh7th/cmp-buffer'
    },
    config = {
      package_root = package_root,
      compile_path = compile_path,
    },
  }
end

local cmp = require 'cmp'

cmp.setup {
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
  }, {
    { name = 'buffer' },
  })
}

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
  load_plugins()
  require('packer').sync()
  vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
  load_plugins()
  require('packer').sync()
end

I can see that the plugin is in the folder. and that it successfully discovers the buffer one, so I am at a loss.

 Directory of C:\Users\<USER>\AppData\Local\Temp\nvim\site\pack\packer\start

27/05/2022  12:10    <DIR>          .
27/05/2022  12:10    <DIR>          ..
27/05/2022  12:10    <DIR>          cmp-buffer
27/05/2022  12:10    <DIR>          cmp-nvim-lsp
27/05/2022  11:53    <DIR>          nvim-cmp
27/05/2022  11:29    <DIR>          nvim-lspconfig
27/05/2022  11:29    <DIR>          packer.nvim
               0 File(s)              0 bytes
               7 Dir(s)  209,480,146,944 bytes free

I am running on Windows NVIM version 7.

yerttle commented 2 years ago

I think this anwsers my question? and that I do not need to worry?

https://github.com/hrsh7th/nvim-cmp/issues/290

yerttle commented 2 years ago

This was all a red hering and every worked as expected.

ayoubelmhamdi commented 1 year ago

because is loaded after the first insert mode, try to enter in insert mode, then test again to verify is worked or not.