Skip to content
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

cmp don't work even my config are seem to be correct #1929

Open
2 tasks done
ryannewcomer opened this issue May 16, 2024 · 2 comments
Open
2 tasks done

cmp don't work even my config are seem to be correct #1929

ryannewcomer opened this issue May 16, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ryannewcomer
Copy link

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

return {
    'hrsh7th/nvim-cmp',
    dependencies = {'L3MON4D3/LuaSnip', 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp'},
	config = function ()
        local luasnip = require("luasnip")
        local cmp = require("cmp")

        cmp.setup({
            snippet = {
                expand = function(args)
                    require('luasnip').lsp_expand(args.body)
                end,
            },
            mapping = {
                ['<CR>'] = cmp.mapping(function(fallback)
                    if cmp.visible() then
                        if luasnip.expandable() then
                            luasnip.expand()
                        else
                            cmp.confirm({
                                select = true,
                            })
                        end
                    else
                        fallback()
                    end
                end),
                ["<Tab>"] = cmp.mapping(function(fallback)
                    if cmp.visible() then
                        cmp.select_next_item()
                    elseif luasnip.locally_jumpable(1) then
                        luasnip.jump(1)
                    else
                        fallback()
                    end
                end, { "i", "s" }),
                ["<S-Tab>"] = cmp.mapping(function(fallback)
                    if cmp.visible() then
                        cmp.select_prev_item()
                    elseif luasnip.locally_jumpable(-1) then
                        luasnip.jump(-1)
                    else
                        fallback()
                    end
                end, { "i", "s" }),
            },
        })
        sources = cmp.config.sources({
            { name = 'nvim_lsp' },
            { name = 'luasnip' }, -- For luasnip users.
        }, {
            { name = 'buffer' },
        })
        local capabilities = require('cmp_nvim_lsp').default_capabilities()
        require('lspconfig')['lua_ls'].setup {
            capabilities = capabilities
        }
    end
}

Description

I have successfully installed lua ls in my lspconfig, I have checked LspInfo and it side that the Lua language server is working and has autostart, in my cmp config, I just changed the keymap to a 'super tab' like. the lsp is working as I can see the error and warning. but as I type, the auto-completion doesn't show up.

:LspInfo
image

Steps to reproduce

install lspconfig, config it to:

return {
	'neovim/nvim-lspconfig',
   config = function ()
		require'lspconfig'.lua_ls.setup{}
		require'lspconfig'.pylsp.setup{}
	end
}

install luasnip, config it:

return {
	'L3MON4D3/LuaSnip',
  dependencies = { "rafamadriz/friendly-snippets" },
	version = 'v2.*',
  build = "make install_jsregexp",
  config = function ()
    require("luasnip.loaders.from_vscode").lazy_load()
  end
}

install cmp, config it.

restart nvim, the plugin is cloned, but auto-completion don't work

Expected behavior

it should show up (the auto-completion)

Actual behavior

PowerShell.2024-05-16.11-50-12.mp4

as you can see, the color scheme work, treesitter work, but not auto complete

Additional context

O.S

windows 11 23H2

nvim version:
image

my full config:
https://github.com/ryannewcomer/nvim-windows

@ryannewcomer ryannewcomer added the bug Something isn't working label May 16, 2024
@longway1024
Copy link

#1692 (comment)
for your information

@erlangparasu
Copy link

erlangparasu commented Jun 16, 2024

Got same issue. cmp completion ( via <C-Space> ) not working on macOS

Related issue from other site:
https://www.reddit.com/r/neovim/comments/19372gt/lazyvim_cmp_not_opening_on_key/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants