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

error when using completion with gopls language server in neovim 0.10.0 #1963

Open
2 tasks done
merzouka opened this issue Jun 18, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@merzouka
Copy link

FAQ

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

Announcement

Minimal reproducible full config

local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}

cmp.setup {
    performance = {
        max_view_entries = 7,
        fetchin_timeout = 1000,
    },
    snippet = {
        expand = function(args)
            luasnip.lsp_expand(args.body)
        end,
    },
    mapping = cmp.mapping.preset.insert {
        ['<C-n>'] = cmp.mapping.select_next_item(),
        ['<C-p>'] = cmp.mapping.select_prev_item(),
        ['<C-u>'] = cmp.mapping.scroll_docs(-4),
        ['<C-d>'] = cmp.mapping.scroll_docs(4),
        ['<C-Space>'] = cmp.mapping.complete {},
        ['<C-e>'] = cmp.mapping.abort(),
        ['<CR>'] = cmp.mapping.confirm {
            behavior = cmp.ConfirmBehavior.Replace,
            -- select first item if none selected
            select = true,
        },
        ['<Tab>'] = cmp.mapping(function(fallback)
            if cmp.visible() then
                cmp.select_next_item()
            elseif luasnip.expand_or_locally_jumpable() then
                luasnip.expand_or_jump()
            else
                fallback()
            end
        end, { 'i', 's' }),
    },
    sources = cmp.config.sources({
        { name = 'nvim_lsp' },
        { name = 'luasnip' },
    }, {
            {
                name = 'buffer',
                options = {
                    get_bufnrs = function()
                        local buf = vim.api.nvim_get_current_buf()
                        local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
                        if byte_size > 1024 * 1024 then -- 1 Megabyte max
                            return {}
                        end
                        return { buf }
                    end
                }
            },
        }),
    view = {
        docs = true
    }
}

Description

whenever i enter a new go file to start coding i get an error, the error is reproduced with every keystroke.

Steps to reproduce

using neovim 0.10.0
using mason with lsp: golsp
the error should appear as soon as you start typing.

Expected behavior

nvim-cmp shows list of compeletion

Actual behavior

i get the follow error
Error executing vim.schedule lua callback: ...[user]/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:291: attempt to index field 'docs' (a boolean va
lue)
stack traceback:
...[user]/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:291: in function 'callback'
...[user]/.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/async.lua:138: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

Additional context

No response

@merzouka merzouka added the bug Something isn't working label Jun 18, 2024
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

1 participant