Error while opening a new line
Whenever I press 'O' to create a new line in normal mode, I get this error
Error executing lua callback: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_deep_extend'
...ite/pack/packer/opt/cmp-buffer/lua/cmp_buffer/source.lua:33: in function '_validate_options'
...ite/pack/packer/opt/cmp-buffer/lua/cmp_buffer/source.lua:45: in function 'get_keyword_pattern'
...re/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/source.lua:240: in function 'complete'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:286: in function 'complete'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:168: in function 'autoindent'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:160: in function 'on_change'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/init.lua:310: in function 'callback'
.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function 'emit'
.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:22>```
Ok I got the same issue, and was too tired last night to figure it out.
After some tinkering, it seems to be an issue to do with the way cmp is added as a nyoom module. Specifically, I get the following error on every insert keystroke if the Rust module is not activated in modules.fnl:
Error detected while processing TextChangedI Autocommands for "*":
Error executing lua callback: vim/shared.lua:0: after the second argument: expected t
able, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_deep_extend'
...ite/pack/packer/opt/cmp-buffer/lua/cmp_buffer/source.lua:33: in function '
_validate_options'
...ite/pack/packer/opt/cmp-buffer/lua/cmp_buffer/source.lua:45: in function '
get_keyword_pattern'
...re/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/source.lua:240: in function
'complete'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:286: in function
'complete'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:168: in function
'callback'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:218: in function
'autoindent'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:160: in function
'on_change'
...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/init.lua:310: in function
'callback'
.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function '
emit'
.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <
.../site/pack/packer/opt/nvim-cmp/lua/cmp/utils/autocmd.lua:22>
The error does not occur if I have the rust module active, but this is imperfect because the point of the modules is that I don't need to use the ones I don't want to.
I managed to mitigate this issue by simply removing the rust source from the cmp module config.fnl:
:sources [(nyoom-module-p! lsp
{:name :nvim_lsp})
{:name :luasnip}
(nyoom-module-p! eval
{:name :conjure})
{:name :buffer}
{:name :path}]
But again, this is still imperfect, because this doesn't fix the problem, just stops it from occurring. I got the above error again when I attempted to fix some cmp lsp issues for .tex files, but I'm not sure what I did.
This might be related or might not be related, but frequently, I get the following error the first time after opening a a file with nyoom after syncing the config:
Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load
.lua:171: Vim(echomsg):E114: Missing quote: "Error in packer_compiled: ...vim/site/pa
ck/packer/opt/packer.nvim/lua/packer/load.lua:160: Vim(append):Error executing lua ca
llback: /usr/local/share/nvim/runtime/filetype.lua:20: Vim(lua):E5108: Error executin
g lua ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:171: Vim(echomsg):E
114: Missing quote: \"Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nv
im/lua/packer/load.lua:142: Vim(source):E5113: Error while calling lua chunk: ...pack
/packer/opt/cmp-conjure/after/plugin/cmp_conjure.lua:1: module 'cmp' not found:
stack traceback:
[C]: in function 'cmd'
...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:171: in function
<...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:167>
...are/nvim/site/pack/packer/opt/packer.nvim/lua/packer.lua:792: in function
<...are/nvim/site/pack/packer/opt/packer.nvim/lua/packer.lua:773>
However, it doesn't seem to stop nyoom from functioning, and does not come up after that first time.
Could you do me a favor and paste the results of ~/.cache/nvim/hotpot/Users/shauryasingh/.config/nvim/fnl/modules/completion/cmp/config.lua (Users/shauryasingh will be replaced your username/userfolder on linux/macOS), something is going wrong with compiling the conditionally enabled sources
local luasnip = require("luasnip")
do end (vim.opt)["completeopt"] = {"menu", "menuone", "noselect"}
local icons = {Text = "\239\131\137", Method = "\239\154\166", Function = "\239\158\148", Constructor = "\226\140\152", Field = "\239\176\160", Variable = "\239\156\155", Class = "\239\180\175", Interface = "\239\131\168", Module = "\239\163\146", Unit = "\229\161\158", Property = "\239\176\160", Value = "\239\162\159", Enum = "\239\133\157", Keyword = "\229\187\147", Snippet = "\239\153\176", Color = "\239\163\151", File = "\239\156\152", Reference = "\239\156\134", Folder = "\239\129\187", EnumMember = "\239\133\157", Constant = "\239\163\191", Struct = "\215\164\214\188", Event = "\239\131\167", Operator = "\239\154\148", TypeParameter = ""}
local function _1_(args)
return luasnip.lsp_expand(args.body)
end
local function _2_(fallback)
if cmp.visible() then
return cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
return luasnip.expand_or_jump()
else
return fallback()
end
end
local function _4_(fallback)
if cmp.visible() then
return cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
return luasnip.jump(-1)
else
return fallback()
end
end
local function _6_(_, vim_item)
vim_item.menu = vim_item.kind
vim_item.kind = icons[vim_item.kind]
return vim_item
end
cmp.setup({experimental = {ghost_text = true}, window = {documentation = {border = "solid"}, completion = {border = "solid"}}, preselect = cmp.PreselectMode.None, snippet = {expand = _1_}, mapping = {["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), ["<up>"] = cmp.config.disable, ["<down>"] = cmp.config.disable, ["<Tab>"] = cmp.mapping(_2_, {"i", "s"}), ["<S-Tab>"] = cmp.mapping(_4_, {"i", "s"}), ["<space>"] = cmp.mapping.confirm({select = false})}, sources = {{name = "nvim_lsp"}, {name = "luasnip"}, {name = "conjure"}, nil, {name = "buffer"}, {name = "path"}}, formatting = {fields = {"kind", "abbr", "menu"}, format = _6_}})
cmp.setup.cmdline("/", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "buffer"}}})
cmp.setup.cmdline(":", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "path"}, {name = "cmdline"}}})
return (require("luasnip.loaders.from_vscode")).lazy_load()```
below is the relevant file with the rust source removed:
local cmp = require("cmp")
local luasnip = require("luasnip")
do end (vim.opt)["completeopt"] = {"menu", "menuone", "noselect"}
local icons = {Text = "\239\131\137", Method = "\239\154\166", Function = "\239\158\148", Constructor = "\226\140\152", Field = "\239\176\160", Variable = "\239\156\155", Class = "\239\180\175", Interface = "\239\131\168", Module = "\239\163\146", Unit = "\229\161\158", Property = "\239\176\160", Value = "\239\162\159", Enum = "\239\133\157", Keyword = "\229\187\147", Snippet = "\239\153\176", Color = "\239\163\151", File = "\239\156\152", Reference = "\239\156\134", Folder = "\239\129\187", EnumMember = "\239\133\157", Constant = "\239\163\191", Struct = "\215\164\214\188", Event = "\239\131\167", Operator = "\239\154\148", TypeParameter = ""}
local function _1_(args)
return luasnip.lsp_expand(args.body)
end
local function _2_(fallback)
if cmp.visible() then
return cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
return luasnip.expand_or_jump()
else
return fallback()
end
end
local function _4_(fallback)
if cmp.visible() then
return cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
return luasnip.jump(-1)
else
return fallback()
end
end
local function _6_(_, vim_item)
vim_item.menu = vim_item.kind
vim_item.kind = icons[vim_item.kind]
return vim_item
end
cmp.setup({experimental = {ghost_text = true}, window = {documentation = {border = "solid"}, completion = {border = "solid"}}, preselect = cmp.PreselectMode.None, snippet = {expand = _1_}, mapping = {["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), ["<up>"] = cmp.config.disable, ["<down>"] = cmp.config.disable, ["<Tab>"] = cmp.mapping(_2_, {"i", "s"}), ["<S-Tab>"] = cmp.mapping(_4_, {"i", "s"}), ["<space>"] = cmp.mapping.confirm({select = false})}, sources = {{name = "nvim_lsp"}, {name = "luasnip"}, {name = "conjure"}, {name = "buffer"}, {name = "path"}}, formatting = {fields = {"kind", "abbr", "menu"}, format = _6_}})
cmp.setup.cmdline("/", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "buffer"}}})
cmp.setup.cmdline(":", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "path"}, {name = "cmdline"}}})
return (require("luasnip.loaders.from_vscode")).lazy_load()
below is the relevant file with the rust source added but not installed as a module:
local cmp = require("cmp")
local luasnip = require("luasnip")
do end (vim.opt)["completeopt"] = {"menu", "menuone", "noselect"}
local icons = {Text = "\239\131\137", Method = "\239\154\166", Function = "\239\158\148", Constructor = "\226\140\152", Field = "\239\176\160", Variable = "\239\156\155", Class = "\239\180\175", Interface = "\239\131\168", Module = "\239\163\146", Unit = "\229\161\158", Property = "\239\176\160", Value = "\239\162\159", Enum = "\239\133\157", Keyword = "\229\187\147", Snippet = "\239\153\176", Color = "\239\163\151", File = "\239\156\152", Reference = "\239\156\134", Folder = "\239\129\187", EnumMember = "\239\133\157", Constant = "\239\163\191", Struct = "\215\164\214\188", Event = "\239\131\167", Operator = "\239\154\148", TypeParameter = ""}
local function _1_(args)
return luasnip.lsp_expand(args.body)
end
local function _2_(fallback)
if cmp.visible() then
return cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
return luasnip.expand_or_jump()
else
return fallback()
end
end
local function _4_(fallback)
if cmp.visible() then
return cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
return luasnip.jump(-1)
else
return fallback()
end
end
local function _6_(_, vim_item)
vim_item.menu = vim_item.kind
vim_item.kind = icons[vim_item.kind]
return vim_item
end
cmp.setup({experimental = {ghost_text = true}, window = {documentation = {border = "solid"}, completion = {border = "solid"}}, preselect = cmp.PreselectMode.None, snippet = {expand = _1_}, mapping = {["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), ["<up>"] = cmp.config.disable, ["<down>"] = cmp.config.disable, ["<Tab>"] = cmp.mapping(_2_, {"i", "s"}), ["<S-Tab>"] = cmp.mapping(_4_, {"i", "s"}), ["<space>"] = cmp.mapping.confirm({select = false})}, sources = {{name = "nvim_lsp"}, {name = "luasnip"}, {name = "conjure"}, nil, {name = "buffer"}, {name = "path"}}, formatting = {fields = {"kind", "abbr", "menu"}, format = _6_}})
cmp.setup.cmdline("/", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "buffer"}}})
cmp.setup.cmdline(":", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "path"}, {name = "cmdline"}}})
return (require("luasnip.loaders.from_vscode")).lazy_load()
below is the relevant file with the rust source added, and rust installed as a module:
local cmp = require("cmp")
local luasnip = require("luasnip")
do end (vim.opt)["completeopt"] = {"menu", "menuone", "noselect"}
local icons = {Text = "\239\131\137", Method = "\239\154\166", Function = "\239\158\148", Constructor = "\226\140\152", Field = "\239\176\160", Variable = "\239\156\155", Class = "\239\180\175", Interface = "\239\131\168", Module = "\239\163\146", Unit = "\229\161\158", Property = "\239\176\160", Value = "\239\162\159", Enum = "\239\133\157", Keyword = "\229\187\147", Snippet = "\239\153\176", Color = "\239\163\151", File = "\239\156\152", Reference = "\239\156\134", Folder = "\239\129\187", EnumMember = "\239\133\157", Constant = "\239\163\191", Struct = "\215\164\214\188", Event = "\239\131\167", Operator = "\239\154\148", TypeParameter = ""}
local function _1_(args)
return luasnip.lsp_expand(args.body)
end
local function _2_(fallback)
if cmp.visible() then
return cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
return luasnip.expand_or_jump()
else
return fallback()
end
end
local function _4_(fallback)
if cmp.visible() then
return cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
return luasnip.jump(-1)
else
return fallback()
end
end
local function _6_(_, vim_item)
vim_item.menu = vim_item.kind
vim_item.kind = icons[vim_item.kind]
return vim_item
end
cmp.setup({experimental = {ghost_text = true}, window = {documentation = {border = "solid"}, completion = {border = "solid"}}, preselect = cmp.PreselectMode.None, snippet = {expand = _1_}, mapping = {["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), ["<up>"] = cmp.config.disable, ["<down>"] = cmp.config.disable, ["<Tab>"] = cmp.mapping(_2_, {"i", "s"}), ["<S-Tab>"] = cmp.mapping(_4_, {"i", "s"}), ["<space>"] = cmp.mapping.confirm({select = false})}, sources = {{name = "nvim_lsp"}, {name = "luasnip"}, {name = "conjure"}, {name = "crates"}, {name = "buffer"}, {name = "path"}}, formatting = {fields = {"kind", "abbr", "menu"}, format = _6_}})
cmp.setup.cmdline("/", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "buffer"}}})
cmp.setup.cmdline(":", {mapping = cmp.mapping.preset.cmdline(), sources = {{name = "path"}, {name = "cmdline"}}})
return (require("luasnip.loaders.from_vscode")).lazy_load()
I think this should be fixed now