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

feat: allows showing output as virtual text #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

uwla
Copy link

@uwla uwla commented Sep 5, 2024

The virtual text works!

However, there is one problem:

Output should not be cleaned when the code block is run again or with MdEvalClean.

Let us work to get it done!

@uwla uwla force-pushed the virtext branch 2 times, most recently from c823028 to 1583f30 Compare September 5, 2024 19:48
@uwla
Copy link
Author

uwla commented Sep 5, 2024

UPDATE: Now it is working great! It cleans previous output when your run MdEval again and it also cleans output with MdEvalClean.

@uwla
Copy link
Author

uwla commented Sep 5, 2024

ok, it is almost done now... but I cant pass any options via opts

Via opts with Lazy:

    {
        url = "https://github.com/jubnzv/mdeval.nvim",
        opts = { virt_text = true },
        cmds = { "MdEval" },
    },

Via setup:

lua require 'mdeval'.setup({})

In both scenarios I get the following error

lazy.nvim

Failed to run `config` for mdeval.nvim

<home>/.local/share/nvim/lazy/mdeval.nvim/lua/mdeval.lua:484: bad argument #1 to 'pairs' (table expected, got nil)

# stacktrace:
  - /mdeval.nvim/lua/mdeval.lua:484 _in_ **setup**
  - ~/.config/nvim/lua/config/lazy.lua:32
  - ~/.config/nvim/lua/init.lua:1
  - lua:1

@uwla
Copy link
Author

uwla commented Sep 10, 2024

@jubnzv can you give some feedback?

@jubnzv
Copy link
Owner

jubnzv commented Sep 13, 2024

Hey @uwla, thank you for the contribution. I’m in the middle of something, but I’ll get to it in a couple of days.

lua/defaults.lua Outdated
@@ -9,6 +9,7 @@ lang_conf["markdown.pandoc"] = { "```", "```" }

M.lang_conf = lang_conf

M.virt_text = false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename here and everywhere to virtual_text in order to increase readability.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The users will also need this in the documentation and the example in README.

Copy link
Owner

@jubnzv jubnzv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uwla How could I enable the virtual text output?

I'm trying to use your branch with the following configuration:

require 'mdeval'.setup({
  virt_text=true,
  require_confirmation=false,
  eval_options = { },
})

When I call :MdEval with a markdown file containing a JS snippet, it prints results as virt_text is not set:

image

@uwla
Copy link
Author

uwla commented Sep 20, 2024

@uwla How could I enable the virtual text output?

I'm trying to use your branch with the following configuration:

require 'mdeval'.setup({
  virt_text=true,
  require_confirmation=false,
  eval_options = { },
})

When I call :MdEval with a markdown file containing a JS snippet, it prints results as virt_text is not set:

image

Hi, this is because I set the default display to NOT be virtual_text and I was having trouble passing the option virt_text to the plugin via the setup options.

I'll push the code such that the virtual text is the default one, that way you can test it.

@uwla
Copy link
Author

uwla commented Sep 20, 2024

NVIM-MDEVAL-VIRTEXT

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

Successfully merging this pull request may close these issues.

2 participants