Skip to content

feat: allows showing output as virtual text#11

Open
uwla wants to merge 1 commit into
jubnzv:masterfrom
uwla:virtext
Open

feat: allows showing output as virtual text#11
uwla wants to merge 1 commit into
jubnzv:masterfrom
uwla:virtext

Conversation

@uwla

@uwla uwla commented Sep 5, 2024

Copy link
Copy Markdown

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

uwla commented Sep 5, 2024

Copy link
Copy Markdown
Author

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

@uwla

uwla commented Sep 5, 2024

Copy link
Copy Markdown
Author

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

uwla commented Sep 10, 2024

Copy link
Copy Markdown
Author

@jubnzv can you give some feedback?

@jubnzv

jubnzv commented Sep 13, 2024

Copy link
Copy Markdown
Owner

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.

Comment thread lua/defaults.lua Outdated

M.lang_conf = lang_conf

M.virt_text = false

Copy link
Copy Markdown
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
Copy Markdown
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.

@jubnzv jubnzv left a comment

Copy link
Copy Markdown
Owner

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

uwla commented Sep 20, 2024

Copy link
Copy Markdown
Author

@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

uwla commented Sep 20, 2024

Copy link
Copy Markdown
Author

NVIM-MDEVAL-VIRTEXT

@uwla

uwla commented Sep 7, 2025

Copy link
Copy Markdown
Author

hello, could we continue this pull request? I can help you test it.

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