Any Mkdn command ends with "Error executing Lua callback:"
suntsu42 opened this issue · 2 comments
When i try to execute a command (e.g. ":MkdnCreateLink" or ":MkdnTable") the followng error is shown:
Error executing Lua callback: ....local/share/nvim/lazy/mkdnflow.nvim/plugin/mkdnflow.lua:119: attempt to index field 'tables' (a nil value)
stack traceback:
....local/share/nvim/lazy/mkdnflow.nvim/plugin/mkdnflow.lua:119: in function <....local/share/nvim/lazy/mkdnflow
.nvim/plugin/mkdnflow.lua:118>
I've boiled down my neovim config to exclude any other problems.
I just download pleanry and mkdnflow. No other configuration is loaded.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
"nvim-lua/plenary.nvim",
"jakewvincent/mkdnflow.nvim"
})
It looks like everything is properly loaded
I've also tested with neovim preview and did test on linux and windows and always got the same error.
Any idea what the reason for this error is?
I did some more digging and tried to access part of the mkdnflow in lua.
local mkdnflow = require('mkdnflow')
print(mkdnflow)
print(mkdnflow.tables)
mkdnflow.tables seems not to be initialized.
I'm guessing that i miss something obvious, but i can't see what the problem is.
After some more digging, i finally found the reason.
I did not configure treesitter properly.
I now configured treesitter with the following settings
require 'nvim-treesitter.configs'.setup {
ensure_installed = { "javascript", "typescript", "c", "lua" },
auto_install = true,
}
When i then started a markdown file in neovim, treesitter did download something and all the mkdnflow commands now work.
It shows the following message (Even i don't fully understand what exactly is installed for markdown)
[nvim-treesitter] [1/1] Treesitter parser for markdown has been installed
I just wasn't aware of this dependency.