-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vim-vsnip not working on Neovim nightly! #219
Comments
I don't actually get that message but yeah Friendly-Snippets are not working ... |
@marwan38 @ndav1d works here but I had to go back from the nightly version of Neovim to the stable 0.5.1. |
oh that's probably why. I'm using EDIT: yup, just checked with the official stable release of neovim and it works |
OK. I will update my environment and checks it. |
vim-vsnip and friendly-snippets works perfectly to me on nightly neovim.
|
I tried the same config on both stable releases and nightly and I don't get any snippets on the nightly... any checks or something I can do? |
does my config look right? EDIT: or perhaps share yours for me to try :) |
My minimal config is here. if has('vim_starting')
set encoding=utf-8
endif
scriptencoding utf-8
if &compatible
set nocompatible
endif
let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end
execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'rafamadriz/friendly-snippets'
call plug#end()
PlugInstall | quit
imap <expr><C-l> vsnip#available(1) ? '<Plug>(vsnip-expand)' : '<C-l>'
smap <expr><C-l> vsnip#available(1) ? '<Plug>(vsnip-expand)' : '<C-l>'
imap <expr><Tab> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<Tab>'
smap <expr><Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr><S-Tab> vsnip#available(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr><S-Tab> vsnip#available(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
lua<<EOF
local cmp = require('cmp')
cmp.setup {
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true })
},
sources = {
{ name = 'vsnip' }
}
}
EOF Sorry. I don't use packer.nvim so I can't test with your config... |
with that config it works... maybe another plugin is messing things up?....... |
@ndav1d Do you get correct result without vim-vsnip-integ? |
It doesn't work as well... |
here are all the plugins I am using: -- Packer --
use 'wbthomason/packer.nvim'
-- Icon support --
use {
'yamatsum/nvim-web-nonicons',
requires = {'kyazdani42/nvim-web-devicons'}
}
-- Smooth Scrolling --
use 'psliwka/vim-smoothie'
-- Scrollbar --
use 'dstein64/nvim-scrollview'
-- Better start screen --
use {'mhinz/vim-startify'}
-- Better matchit --
use 'andymass/vim-matchup'
-- Indentation --
use 'tpope/vim-sleuth'
-- Auto comment --
use 'tpope/vim-commentary'
-- Easy Align --
use {'junegunn/vim-easy-align', keys = {{'x', '<plug>(LiveEasyAlign)'}}}
-- Hop --
use {
'phaazon/hop.nvim',
as = 'hop',
config = function()
require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
end
}
-- Surround text --
use 'tpope/vim-surround'
-- Complete brackets --
use 'jiangmiao/auto-pairs'
-- Startuptime --
use 'dstein64/vim-startuptime'
-- RFC --
use 'mhinz/vim-rfc'
-- Cheat.sh --
use 'dbeniamine/cheat.sh-vim'
-- Md previewer --
use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install'}
-- Colorizer --
use {'norcalli/nvim-colorizer.lua'}
-- Git --
use 'tpope/vim-fugitive'
use 'mhinz/vim-signify'
-- Sql.nvim --
use 'tami5/sql.nvim'
-- Lua Scratchpad --
use 'rafcamlet/nvim-luapad'
-- View tags --
use 'liuchengxu/vista.vim'
-- Telescope --
use {'nvim-telescope/telescope.nvim', requires = {
'nvim-lua/popup.nvim',
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-fzy-native.nvim',
'nvim-telescope/telescope-fzf-writer.nvim',
'nvim-telescope/telescope-symbols.nvim',
'nvim-telescope/telescope-frecency.nvim',
}}
-- Treesitter --
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', requires =
'windwp/nvim-ts-autotag'}
use 'nvim-treesitter/playground'
-- LSP --
use {'neovim/nvim-lspconfig', requires = 'mfussenegger/nvim-jdtls'}
use 'hrsh7th/vim-vsnip'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-vsnip'
use 'rafamadriz/friendly-snippets'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'ray-x/cmp-treesitter'
use 'f3fora/cmp-spell' |
can't figure out what's wrong with my config |
If I met the plugin combination bug, I usually binary search with disabling plugins one by one... |
I'm having similar issues, the plugin causing issues for me was vim-matchup, which I noticed you also have @ndav1d somehow vim-matchup was messing with the completion menu for nvim-cmp in showing snippets, although they still won't expand. continuing to tinker with it |
I will check what is happend here. |
It's definitely some kind of plugin or setting interaction, since your minimal config file works perfectly for me. I'm doing a binary search through my config edit: something I'm realizing - I'm not seeing the same behavior between what I think are lsp snippets and the ones installed by friendly snippets. think I need to setup the |
Just tried removing it but the issue still persists... |
I realised that I had forgotten to add the capabilities to my lsp configs, but, that did not bring back my snippets. Snippets work with |
@marwan38 could you try it with |
Nope, nothing. |
same... let's keep trying... if the minimal config works then it has got to be some sort of plugin incompatibility |
Something weird is going... the issue seems to be related with a plugin because the minimal reproduce works. But... it also works with my config if I use stable neovim... Confusing... |
possibly related andymass/vim-matchup#186 |
hmm the thing is.. even if I remove matchup the issue still persists |
Has anyone tried binary search? |
I did but I wasn't able to pinpoint what's causing the issue |
@hrsh7th could I send you my config and you try it? I have literally tried isolating every plugin and I still can't figure out what's wrong... Do you have a place I could send you my configs? |
You could try loading use {
'hrsh7th/cmp-vsnip',
after = 'nvim-cmp',
requires = {
'hrsh7th/vim-vsnip',
{
'rafamadriz/friendly-snippets',
after = 'cmp-vsnip'
}
}
}, |
woah that indeed works!! Is there a perhaps more simple way of getting the same output? |
@wbthomason any thoughts on that ^ ^ ^ |
I currently have this on my config and it is working... use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'ray-x/cmp-treesitter'
use 'f3fora/cmp-spell'
use {
'hrsh7th/cmp-vsnip',
after = 'nvim-cmp',
requires = {
'hrsh7th/vim-vsnip',
{
'rafamadriz/friendly-snippets',
after = 'cmp-vsnip'
}
}
} But maybe it would be better if every |
@ndav1d You could write a loop like: local cmp_plugins = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'ray-x/cmp-treesitter',
'f3fora/cmp-spell',
{
'hrsh7th/cmp-vsnip',
after = 'nvim-cmp',
requires = {
'hrsh7th/vim-vsnip',
{
'rafamadriz/friendly-snippets',
after = 'cmp-vsnip',
},
},
},
}
for _, spec in ipairs(cmp_plugins) do
if type(spec) == 'string' then
spec = { spec }
end
if spec.after == nil then
spec.after = 'nvim-cmp'
else
if type(spec.after) == 'string' then
spec.after = {spec.after}
end
spec.after[#spec.after + 1] = 'nvim-cmp'
end
use(spec)
end Though I'll note that this is probably overkill for a small set of plugins. It would be interesting if |
@wbthomason it would be a killer feature! pls implement it <33 |
What do you mean? How do you apply a binary search against a plugin list? I tried disabling all my plugins, only thing remained was the completion and LSP.
Unfortunately, that doesn't work for me either. I will try luasnip after work and see if that one works for me. |
@marwan38 use {
'hrsh7th/cmp-vsnip',
after = 'nvim-cmp',
requires = {
'hrsh7th/vim-vsnip',
{
'rafamadriz/friendly-snippets',
after = 'cmp-vsnip'
}
}
}, |
I believe the LuaSnip will work for you :) |
It was indeed the version of nvim. |
Hmmm interesting - it works for me on Nightly without a problem ...
This is my nvim-cmp configuration:use {
'hrsh7th/nvim-cmp',
requires = {
{
'hrsh7th/cmp-nvim-lua',
after = 'nvim-cmp'
},
{
'hrsh7th/cmp-nvim-lsp',
after = 'nvim-cmp',
},
{
'hrsh7th/cmp-vsnip',
after = 'nvim-cmp',
requires = {
'hrsh7th/vim-vsnip',
{
'rafamadriz/friendly-snippets',
after = 'cmp-vsnip'
}
}
},
{
'f3fora/cmp-spell',
after = 'nvim-cmp'
},
{
'hrsh7th/cmp-buffer',
after = 'nvim-cmp'
},
{
'hrsh7th/cmp-calc',
after = 'nvim-cmp'
},
{
'hrsh7th/cmp-path',
after = 'nvim-cmp'
},
},
config = function()
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require('cmp')
cmp.setup {
documentation = {
border = 'rounded'
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
buffer = '[Buffer]',
calc = '[Calc]',
vsnip = '[Snippet]',
nvim_lsp = '[LSP]',
nvim_lua = '[Lua]',
path = '[Filesystem]',
spell = '[Spelling]',
})[entry.source.name]
vim_item.kind = vim.lsp.protocol.CompletionItemKind[vim_item.kind] .. ' ' .. vim_item.kind
return vim_item
end
},
mapping = {
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn['vsnip#available']() == 1 then
feedkey('<Plug>(vsnip-expand-or-jump)', '')
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn['vsnip#jumpable'](-1) == 1 then
feedkey('<Plug>(vsnip-jump-prev)', '')
end
end, { 'i', 's' }),
['<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.Insert,
select = true,
}),
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end
},
sources = {
{name = 'nvim_lua'},
{name = 'nvim_lsp'},
{name = 'buffer',
opts = {
get_bufnrs = function()
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
bufs[vim.api.nvim_win_get_buf(win)] = true
end
return vim.tbl_keys(bufs)
end
}
},
{name = 'vsnip'},
{name = 'spell'},
{name = 'path'},
{name = 'calc'},
}
}
end,
}
|
I was also having this problem with nightly but not 0.5.1 (but I don't use use {
"hrsh7th/vim-vsnip",
requires = {
{ "hrsh7th/vim-vsnip-integ", after = "vim-vsnip" },
{ "rafamadriz/friendly-snippets", after = "vim-vsnip" },
},
} Before doing this, I disabled all other plugins and the problem persisted. For me, it was not a plugin interaction problem. |
I think it's not a vsnip problem. What do you think about it...? |
yeah it's probably not. It seems to be related with the order the plugin manager is loading the various plugins... so I think I'm going to close this issue |
Found my issue, it was the one thing I forget to disable because it existed in the root of my config. It was |
Good to know! :D |
Hi, I have the following config:
plugins.lua
:cmp_config.lua
:Shouldn't Friendly-Snippets work with this config or am I missing something?
The text was updated successfully, but these errors were encountered: