saadparwaiz1 / cmp_luasnip

luasnip completion source for nvim-cmp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Candidates will be displayed twice.

uga-rosa opened this issue · comments

can't reproduce with this minimum config.

vim.cmd [[packadd packer.nvim]]

require('packer').startup(function()
	use 'wbthomason/packer.nvim'
	use {
		'L3MON4D3/LuaSnip',
		requires = {
			'rafamadriz/friendly-snippets'
		}
	}
	use {
		'hrsh7th/nvim-cmp',
		requires = {
			'hrsh7th/cmp-nvim-lsp',
			'saadparwaiz1/cmp_luasnip'
		}
	}

	use {
		'neovim/nvim-lspconfig'
	}
end)

require('luasnip').config.setup({})
require('luasnip.loaders.from_vscode').load()


local cmp = require('cmp')
cmp.setup {
	snippet = {
		expand = function(args)
			require'luasnip'.lsp_expand(args.body)
		end
	},
	sources = {
		{ name = 'luasnip' },
		{ name = 'nvim_lsp'},
	},
	mapping = {
	  ['<C-d>'] = cmp.mapping.scroll_docs(-4),
	  ['<C-f>'] = cmp.mapping.scroll_docs(4),
	  ['<C-Space>'] = cmp.mapping.complete(),
	  ['<C-e>'] = cmp.mapping.close(),
	  ['<CR>'] = cmp.mapping.confirm({
	    behavior = cmp.ConfirmBehavior.Replace,
	    select = true,
	  })
	}
}

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

require'lspconfig'.clangd.setup {
  capabilities = capabilities,
}

Now that I know which plugin is causing the problem, I close this issue.
I thought it would reproduce even with that setting, but there was one that I had manually added locally hahaha

Now that I know which plugin is causing the problem, I close this issue. I thought it would reproduce even with that setting, but there was one that I had manually added locally hahaha

@uga-rosa I am currently having the same issue, can you tell me what plugin was causing this issue?

@ram02z That's a plugin I made myself.
The problem with this plugin should have been solved by PR the other day, but... I wonder why.

@ram02z can you reproduce the issue with the above minimum config?

@ram02z can you reproduce the issue with the above minimum config?

Not sure how to run that config. I also use packer and it seems to conflict when I run with nvim -u min.lua or nvim -u min.lua --no-plugin

Try with --clean and -u.

Try with --clean and -u.

Doesn't work unfortunately.

Isn't there a plugin left under ~/.local/share/nvim/site/pack/packer/?
You can use package_root in packer.init.
It's quicker to move it once.

I managed to fix it by not lazy loading nvim-cmp.

I have the same problem, candidates being displayed twice. I have followed the basic setup instructions. I have a lot of plugins but nothing custom WRT nvim-cmp and I don't thing I am doing anything weird. I am not lazy loading nvim-cmp.

Any additional pointers to help me solve this?
Duplication adds quite a lot of noise 🙏