benlubas/molten-nvim

[Help] [Molten] Cell not Found

teimurlu opened this issue · 3 comments

Molten cannot find cells and using Quarto produces the following message:

No code chunks found for the current language, which is detected based on the current code block. Is your cursor in a code block?

Below are my plugin.lua files. What am I doing wrong?

molten-nvim.lua:

return {
  {
    "benlubas/molten-nvim",
    version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes
    build = ":UpdateRemotePlugins",
    init = function()
      -- Configuration options
      vim.g.molten_output_win_max_height = 12
      vim.g.molten_auto_open_output = false
      vim.g.molten_image_provider = "image.nvim"
      vim.g.molten_wrap_output = true
      vim.g.molten_virt_text_output = true
      vim.g.molten_virt_lines_off_by_1 = true

      -- Key mappings
      vim.keymap.set("n", "<leader>mi", ":MoltenInit<CR>", { silent = true, desc = "Initialize Molten" })
      vim.keymap.set(
        "n",
        "<leader>me",
        ":MoltenEvaluateOperator<CR>",
        { silent = true, desc = "Molten run operator selection" }
      )
      vim.keymap.set("n", "<leader>rl", ":MoltenEvaluateLine<CR>", { silent = true, desc = "Molten evaluate line" })
      vim.keymap.set(
        "n",
        "<leader>rr",
        ":MoltenReevaluateCell<CR>",
        { silent = true, desc = "Molten re-evaluate cell" }
      )
      vim.keymap.set(
        "v",
        "<leader>r",
        ":<C-u>MoltenEvaluateVisual<CR>gv",
        { silent = true, desc = "Molten evaluate visual selection" }
      )
      vim.keymap.set(
        "n",
        "<leader>mo",
        ":noautocmd MoltenEnterOutput<CR>",
        { silent = true, desc = "Molten enter output" }
      )
    end,
  },
  {
    -- see the image.nvim readme for more information about configuring this plugin
    "3rd/image.nvim",
    opts = {
      backend = "kitty", -- whatever backend you would like to use
      max_width = 100,
      max_height = 12,
      max_height_window_percentage = math.huge,
      max_width_window_percentage = math.huge,
      window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
      window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
    },
  },
}

jupytext.lua:

  return {
    "GCBallesteros/jupytext.nvim",
    config = function()
      require("jupytext").setup({
        custom_language_formatting = {
          python = {
            extension = "md",
            style = "markdown",
            force_ft = "markdown", 
        },
      })
    end,
    lazy = false,
}

quarto.lua

return {
  {
    "jmbuhr/otter.nvim",
    lazy = false,
  },
  {

    "quarto-dev/quarto-nvim", 
    ft = { "quarto", "markdown" },
    config = function()
      local runner = require("quarto.runner")

      -- Set up key mappings for quarto.runner
      vim.keymap.set("n", "<leader>rc", runner.run_cell, { desc = "run cell", silent = true })
      vim.keymap.set("n", "<leader>ra", runner.run_above, { desc = "run cell and above", silent = true })
      vim.keymap.set("n", "<leader>rA", runner.run_all, { desc = "run all cells", silent = true })
      -- vim.keymap.set("n", "<leader>rl", runner.run_line, { desc = "run line", silent = true })
      vim.keymap.set("v", "<leader>r", runner.run_range, { desc = "run visual range", silent = true })
      vim.keymap.set("n", "<leader>RA", function()
        runner.run_all(true)
      end, { desc = "run all cells of all languages", silent = true })
    end,
    lazy = false,
  },
}

I'll copy my response from the closed issue


Also using Quarto complains about code runner not being initialised

You need to run :QuatoActivate probably

Finally Molten cannot find cells.

I assume you're using :MoltenEvaluateCell when a cell doesn't exist yet. Molten cell != markdown/quarto cell.

Molten cells are defined in the molten readme

I'll copy my response from the closed issue

Also using Quarto complains about code runner not being initialised

You need to run :QuatoActivate probably

Finally Molten cannot find cells.

I assume you're using :MoltenEvaluateCell when a cell doesn't exist yet. Molten cell != markdown/quarto cell.

Molten cells are defined in the molten readme

Is this a correct cell? I use Jupytext to convert the file to markdown format, then I do call :QuatoActivate command. Then I run :MoltenReEvaluateCell and I get the error. I do not get any errors when I run line by line.

image

When you execute some code, it will create a cell. You can recognize a cell because it will be highlighted when your cursor is in it.

Please read the README. Molten knows nothing about the file format that your code is in