hrsh7th / vim-vsnip

Snippet plugin for vim/nvim that supports LSP/VSCode's snippet format.
MIT License
876 stars 37 forks source link

vsnip not working after upgrade to neovim 0.5.1 #233

Closed phuongthuan closed 2 years ago

phuongthuan commented 2 years ago

Hi guys,

neovim-cmp and vim-vsnip are awesome plugins 🥇 . These pairs work very perfectly. I'm using it every day to speed up my coding time. I really love them ❤️

Today I just updated my neovim to 0.5.1 then my vsnip is not work anymore in javascript file.

Basically when I open to edit a javascript snippet file with :VsnipOpen<CR> . It shows an error like the below:

image

I just walk around check some changelog and breaking changes and I updated my config like this:

Here is my config:

vsnip.lua

map('n', '<leader>V', ':VsnipOpen<CR>')

cmd [[
  let g:vsnip_snippet_dir = expand('~/.vsnip') => I stored all my snippets in this folder. After upgrade to the neovim 0.5.1, I added this line
  let g:vsnip_filetypes = {}
  let g:vsnip_filetypes.javascriptreact = ['javascript']
  let g:vsnip_filetypes.typescriptreact = ['typescript']
  imap <expr> <C-l>   vsnip#available(1)  ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
  smap <expr> <C-l>   vsnip#available(1)  ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
]]

cmp.lua

    snippet = {
        expand = function(args)
            vim.fn["vsnip#anonymous"](args.body)
        end
    },

In Lua file, the snippet still work but I cannot use <Tab>

        ['<Tab>'] = function(fallback)
            if cmp.visible() then
                cmp.select_next_item()
            elseif vim.fn['vsnip#available']() == 1 then
                vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-expand-or-jump)', true, true, true), '')
            else
                fallback()
            end
        end

How can I fix this? Thanks

hrsh7th commented 2 years ago

What is the Autostart for efm failed?

phuongthuan commented 2 years ago

I don't know what is it. That's my concern.

Shougo commented 2 years ago

It seems efm LSP warning message

hrsh7th commented 2 years ago

At least vim-vsnip doesn't have the code to print that error. Perhaps your vimrc contains require('lspconfig').efm.setup {...}. Please review the settings again.

hrsh7th commented 2 years ago

https://github.com/neovim/nvim-lspconfig/blob/29dbd9fa74622338f62f0bebce7b5ce6a2138d3c/lua/lspconfig/configs.lua#L107

This message will printed by nvim-lspconfig.

I haven't recently made any of these related fixes to vim-vsnip.