You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I randomly see the same error as described in the closed issue #33
Error executing vim.schedule lua callback: .../share/nvim/plugged/cmp-buffer/lua/cmp_buffer/buffer.lua:356: bad argument #1 to 'ipairs' (table expecte
d, got userdata)
stack traceback:
[C]: in function 'ipairs'
.../share/nvim/plugged/cmp-buffer/lua/cmp_buffer/buffer.lua:356: in function 'rebuild_unique_words'
.../share/nvim/plugged/cmp-buffer/lua/cmp_buffer/buffer.lua:342: in function 'get_words'
.../share/nvim/plugged/cmp-buffer/lua/cmp_buffer/source.lua:66: in function 'fn'
vim/_editor.lua:380: in function 'cb'
vim/_editor.lua:256: in function <vim/_editor.lua:256>
I can not provide a way to reproduce.
My relevant config (nvim 0.7.0):
" LSP (Intellisense / Autocomplete)
Plug 'neovim/nvim-lspconfig' " Start LSP server on demand
Plug 'hrsh7th/nvim-cmp' " Autocomplete
Plug 'hrsh7th/cmp-buffer' " Buffer word completion source for nvim-cmp
Plug 'hrsh7th/cmp-cmdline' " Command line / search completions
Plug 'hrsh7th/cmp-nvim-lsp' " LSP completion source for nvim-cmp
Plug 'hrsh7th/cmp-nvim-lua' " LUA completion source for nvim-cmp
Plug 'hrsh7th/cmp-nvim-lsp-signature-help' " LSP function signature
Plug 'hrsh7th/cmp-path' " Path completion source for nvim-cmp
Plug 'hrsh7th/cmp-vsnip' " vsnip completion source for nvim-cmp
Plug 'hrsh7th/vim-vsnip' " Snippets plugin
Plug 'rafamadriz/friendly-snippets', { 'branch': 'main' } " Snippets collection
lua <<EOF
--
-- For breaking changes see: https://github.com/hrsh7th/nvim-cmp/issues/231
--
local cmp = require'cmp'
-- Check if there's a word before the cursor (used by <TAB> mapping)
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
-- Send feed keys with special codes (used by <S-TAB> mapping)
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
cmp.setup({
-- Configure snippet engine
snippet = {
expand = function(args)
-- We use vim-vsnip
vim.fn["vsnip#anonymous"](args.body)
end,
},
-- :h cmp-mapping
mapping = {
-- Navigate up/down (i, c: insert & command line mode)
['<C-j>'] = cmp.mapping(cmp.mapping.select_next_item(), {'i', 'c'}),
['<C-k>'] = cmp.mapping(cmp.mapping.select_prev_item(), {'i', 'c'}),
-- Open / close completion menu
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<CR>'] = cmp.mapping.confirm({ select = false }),
-- Make Tab/S-Tab behave context sensitive
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"]() == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{
name = 'buffer',
option = {
-- complete from all buffers
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end
},
},
{ name = 'nvim_lua' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'path' },
}),
formatting = {
format = require("lspkind").cmp_format({
with_text = true,
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
vsnip = "[Vsnip]",
nvim_lua = "[Lua]",
path = "[Path]",
})
}),
},
})
-- Completion for :commands
cmp.setup.cmdline(':', {
sources = {
{ name = 'cmdline' }
}
})
-- Completion for /search based on current buffer
cmp.setup.cmdline('/', {
sources = cmp.config.sources({
{ name = 'buffer' }
})
})
local lspconfig = require'lspconfig'
local cmp_nvim_lsp = require'cmp_nvim_lsp'
-- Set global defaults for all servers
lspconfig.util.default_config = vim.tbl_extend(
"force",
lspconfig.util.default_config,
{
-- Required by nvim-cmp
capabilities = cmp_nvim_lsp.update_capabilities(vim.lsp.protocol.make_client_capabilities()),
}
)
EOF
The text was updated successfully, but these errors were encountered:
Error executing vim.schedule lua callback: ...\Local\nvim\plugged\cmp-buffer/lua/cmp_buffer/buffer.lua:356: bad argument #1 to 'ipairs' (table expected, got userdata)
stack traceback:
[C]: in function 'ipairs'
...\Local\nvim\plugged\cmp-buffer/lua/cmp_buffer/buffer.lua:356: in function 'rebuild_unique_words'
...\Local\nvim\plugged\cmp-buffer/lua/cmp_buffer/buffer.lua:341: in function 'get_words'
...\Local\nvim\plugged\cmp-buffer/lua/cmp_buffer/source.lua:66: in function 'fn'
vim/_editor.lua:380: in function 'cb'
vim/_editor.lua:256: in function <vim/_editor.lua:256>
It seems to only appear when I type on a dap-repl buffer, which is a debugger console from mfussenegger/nvim-dap.
It's a shame the callback does not indicate anything wrong in config.lua.
I randomly see the same error as described in the closed issue #33
I can not provide a way to reproduce.
My relevant config (nvim 0.7.0):
The text was updated successfully, but these errors were encountered: