hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.47k stars 370 forks source link

[Deprecation] Neovim 0.10 warns with `vim.lsp.util.parse_snippet() is deprecated. :help deprecated` #1830

Closed ColinKennedy closed 4 months ago

ColinKennedy commented 4 months ago

FAQ

Announcement

Minimal reproducible full config

Any valid / minimal nvim-cmp configuration

Click To Expand ```vim call plug#begin(s:plug_dir) Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' Plug 'hrsh7th/nvim-cmp' " For vsnip users. Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/vim-vsnip' " For luasnip users. " Plug 'L3MON4D3/LuaSnip' " Plug 'saadparwaiz1/cmp_luasnip' " For ultisnips users. " Plug 'SirVer/ultisnips' " Plug 'quangnguyen30192/cmp-nvim-ultisnips' " For snippy users. " Plug 'dcampos/nvim-snippy' " Plug 'dcampos/cmp-snippy' call plug#end() lua <'] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' }, -- For vsnip users. -- { name = 'luasnip' }, -- For luasnip users. -- { name = 'ultisnips' }, -- For ultisnips users. -- { name = 'snippy' }, -- For snippy users. }, { { name = 'buffer' }, }) }) -- Set configuration for specific filetype. cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). }, { { name = 'buffer' }, }) }) -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }) }) -- Set up lspconfig. local capabilities = require('cmp_nvim_lsp').default_capabilities() -- Replace with each lsp server you've enabled. require('lspconfig')[''].setup { capabilities = capabilities } EOF ```

Description

When using nvim-cmp for regular use, this warning occurs

vim.lsp.util.parse_snippet() is deprecated. :help deprecated                                                                  
This feature will be removed in Nvim version 0.11                                                                             
stack traceback:                                                                                                              
        /usr/local/share/nvim/runtime/lua/vim/lsp/util.lua:616: in function 'parse_snippet'                                   
        .../personal/.config/nvim/bundle/nvim-cmp/lua/cmp/entry.lua:124: in function 'callback'                               
        ...nal/.config/nvim/bundle/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_word'                                
        .../personal/.config/nvim/bundle/nvim-cmp/lua/cmp/entry.lua:75: in function 'callback'                                
        ...nal/.config/nvim/bundle/nvim-cmp/lua/cmp/utils/cache.lua:38: in function 'get_offset'                              
        ...personal/.config/nvim/bundle/nvim-cmp/lua/cmp/source.lua:318: in function ''                                       
        vim/_editor.lua: in function <vim/_editor.lua:0>

Steps to reproduce

Load nvim-cmp and complete a snippet as normal

Expected behavior

No warning

Actual behavior

A warning

Additional context

I didn't see a GitHub issue for this so I figured I'd make one to track the issue. The deprecation occurs in this PR: https://github.com/neovim/neovim/pull/25733

Shougo commented 4 months ago

https://github.com/hrsh7th/nvim-cmp/pull/1734

I think it is already fixed. Your version is the latest?

ColinKennedy commented 4 months ago

Oh I see, I was out of date because I bounded the plugin to the latest major (0.*). Thank you for double checking @Shougo !

    {
        "hrsh7th/nvim-cmp",
        config = function()
            { ... }  -- My config
        end,
        dependencies = { ... },
        event = { "InsertCharPre" },
        version = "0.*",
    },

Once I removed version = "0.*", it worked. It'd be nice for this plugin to have up to date tags as the last one was made in 2022

Shougo commented 4 months ago

So the issue should be closed.

ColinKennedy commented 4 months ago

Would still be nice to get a new tag for this repository but the original issue no longer applies. Closing

Shougo commented 4 months ago

The release problem is https://github.com/hrsh7th/nvim-cmp/issues/1719.