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

Any Mkdn command ends with "Error executing Lua callback:" #189

Closed
suntsu42 opened this issue Jan 12, 2024 · 2 comments
Closed

Any Mkdn command ends with "Error executing Lua callback:" #189

suntsu42 opened this issue Jan 12, 2024 · 2 comments

Comments

@suntsu42
Copy link

When i try to execute a command (e.g. ":MkdnCreateLink" or ":MkdnTable") the followng error is shown:

image

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
image

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?

@suntsu42
Copy link
Author

I did some more digging and tried to access part of the mkdnflow in lua.

   local mkdnflow = require('mkdnflow')
   print(mkdnflow) 
   print(mkdnflow.tables) 

The output looks like this:
image

mkdnflow.tables seems not to be initialized.

I'm guessing that i miss something obvious, but i can't see what the problem is.

@suntsu42
Copy link
Author

suntsu42 commented Jan 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant