MeanderingProgrammer / render-markdown.nvim

Plugin to improve viewing Markdown files in Neovim
MIT License
1.39k stars 33 forks source link

bug: ipairs argument expects table, not a nil value. #65

Closed akthe-at closed 2 months ago

akthe-at commented 2 months ago

Neovim version (nvim -v)

0.10.0

Operating system

Windows

Terminal emulator / GUI

Wezterm

Describe the bug

Attempted to open an obsidian.nvim markdown file of mine and was met with the following error: Error executing vim.schedule lua callback: ...vim-data/lazy/render-markdown/lua/render-markdown/ui.lua:82: bad argument #1 to 'ipairs' (table expected, got nil) stack traceback: [C]: in function 'ipairs' ...vim-data/lazy/render-markdown/lua/render-markdown/ui.lua:82: in function 'refresh' ...vim-data/lazy/render-markdown/lua/render-markdown/ui.lua:32: in function <...vim-data/lazy/render-markdown/lua/render-markdown/ui.lua:30>

It seems like the new change was not handling an empty table very well. I am not familiar with your code base but I successfully attempted a quick fix. PR Incoming!

Expected behavior

I have opened this file several times this week prior to your two latest commits without any issue or error...I wasn't sure what to expect with the new full conceal behavior but I didn't expect the error.

Healthcheck output (:checkhealth render-markdown)

render-markdown: require("render-markdown.health").check()

markdown.nvim [neovim version] ~

markdown.nvim [configuration] ~

markdown.nvim [nvim-treesitter] ~

markdown.nvim [executables] ~

Additional information

No response

tristan-harris commented 2 months ago

Are you using the Telescope plugin by any chance? I am also getting the same error, but only when opening a file with Telescope. Other plugins such as neo-tree as well as plain :e work fine.

akthe-at commented 2 months ago

@tristan-harris I have fzf-lua as my main picker but I actually do have telescope installed for a few select plugin interactions...

MeanderingProgrammer commented 2 months ago

Are you using the Telescope plugin by any chance? I am also getting the same error, but only when opening a file with Telescope. Other plugins such as neo-tree as well as plain :e work fine.

Ah, interesting. I know there are various issues related to opening the buffer with Telescope: https://github.com/MeanderingProgrammer/markdown.nvim/blob/main/doc/limitations.md.

Thanks for brining that up!

I believe fzf had some similar issues for changing modes to open the buffer: https://github.com/MeanderingProgrammer/markdown.nvim/issues/36.

I can definitely see the latest changes causing more edge cases related to this. Since after opening the buffer often they'll also move the cursor to the last active position.

MeanderingProgrammer commented 2 months ago

Telescope and fzf stuff should work better after last commit