hrsh7th / nvim-cmp

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

There's some extra `${}` text inserted when selecting first item #1801

Closed yehuohan closed 5 months ago

yehuohan commented 5 months ago

FAQ

Announcement

Minimal reproducible full config

    {
        'hrsh7th/nvim-cmp',
        config = function()
            require('mason').setup({ install_root_dir = vim.env.DotVimLocal .. '/.mason' })
            require('mason-lspconfig').setup({})
            local lspconfig = require('lspconfig')
            local capabilities = require('cmp_nvim_lsp').default_capabilities()
            local opts = {
                function(server_name) lspconfig[server_name].setup({ capabilities = capabilities }) end,
            }
            require('mason-lspconfig').setup_handlers(opts)
            local cmp = require('cmp')
            cmp.setup({
                mapping = {
                    ['<M-i>'] = cmp.mapping(function() cmp.complete() end, { 'i' }),
                    ['<M-j>'] = cmp.mapping(function() cmp.select_next_item() end, { 'i', 'c' }),
                    ['<M-k>'] = cmp.mapping(function() cmp.select_prev_item() end, { 'i', 'c' }),
                },
                sources = cmp.config.sources({ { name = 'nvim_lsp' } }),
                preselect = cmp.PreselectMode.None,
            })
        end,
        dependencies = {
            'williamboman/mason.nvim',
            'williamboman/mason-lspconfig.nvim',
            'neovim/nvim-lspconfig',
            'hrsh7th/cmp-nvim-lsp',
        },
    },

Description

cmp

Like the picture showed. When typing Box::ne and select the first ne item, there's some extra ${} text inserted.

Steps to reproduce

Type some text and select the first item.

Expected behavior

No ${} text inserted when selecting the first item.

Actual behavior

There's extra ${} text inserted when selecting the first item.

Additional context

No response

Shougo commented 5 months ago

Dup of #1800.