Skip to content

bug: invalid key: conceal_lines #382

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

Closed
2 tasks done
justin-ramirez-gametime opened this issue Mar 28, 2025 · 5 comments
Closed
2 tasks done

bug: invalid key: conceal_lines #382

justin-ramirez-gametime opened this issue Mar 28, 2025 · 5 comments
Labels
not a bug Not a bug in this plugin

Comments

@justin-ramirez-gametime

Neovim version (nvim -v)

v0.11.0-dev-1517+ga37784ad83

Neovim distribution

N/A

Operating system

MacOS

Terminal emulator / GUI

ghostty

Describe the bug

Error executing vim.schedule lua callback: ...ender-markdown.nvim/lua/render-markdown/core/extmark.lua:37: invalid key: conceal_lines
stack traceback:
[C]: in function 'nvim_buf_set_extmark'
...ender-markdown.nvim/lua/render-markdown/core/extmark.lua:37: in function 'show'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:150: in function 'run_update'
...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:90: in function <...azy/render-markdown.nvim/lua/render-markdown/core/ui.lua:89>

Expected behavior

I have tried removing and reinstalling render-markdown.

Healthcheck output

render-markdown.nvim [version] ~
- OK plugin 8.1.22
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- OK latex: parser installed
- OK html: parser installed
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: nvim-web-devicons

render-markdown.nvim [executables] ~
- OK latex2text: not installed

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK markview: not installed
- OK obsidian: not installed

Plugin configuration

{
  file_types = {
    [2] = "Avante"
  },
  latex = {
    enabled = false
  }
}

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@justin-ramirez-gametime justin-ramirez-gametime added the bug Something isn't working label Mar 28, 2025
@MeanderingProgrammer
Copy link
Owner

MeanderingProgrammer commented Mar 28, 2025

You must have an old build of 0.11.0. I don't have a great way of gating functionality other than a version check and that version check assumes you have the release build. conceal_lines was added in 0.11.0, but must be at some point later than your build. If you have a better way to gate functionality than the vim.fn.has('nvim-0.11') == 1 checks LMK, otherwise you'll need to update.

@MeanderingProgrammer MeanderingProgrammer added not a bug Not a bug in this plugin and removed bug Something isn't working labels Mar 28, 2025
@theTechGoose
Copy link

theTechGoose commented Mar 31, 2025

I think you could do a check to see if conceal_lines exists. if it does not we could polyfill it. What do you think @MeanderingProgrammer ?

I can also confirm that it is an older version of nvim. For those of using brew you need to:

brew install neovim --HEAD
brew link --overwrite neovim

@MeanderingProgrammer
Copy link
Owner

I think you could do a check to see if conceal_lines exists.

Any suggestion on how, that's kind of what the version checks were meant to catch but there are these edge cases. I can wrap the nvim_buf_set_extmark calls in pcalls at least to prevent errors from bubbling up to users, but then things would silently fail, with only some errors written to a log file.

if it does not we could polyfill it.

I don't think there would be a way to polyfill it, prior to the vertical conceal logic added by conceal_lines there was no way to hide vertical space. It would be similar to trying to polyfill inline virtual text to neovim 0.9.0, maybe theoretically possible by hacking some other features together, but in no way would I want to maintain that logic in this repo.

@theTechGoose
Copy link

Oh, I think you are right on all accounts here. The best solution I think here may be to add a "if you get this" then do this to the installation guide in the readme. since this is used in avante I think it should be added there too.

But all of that is just for the sake of completeness because if someone has that issue and knows how to look they will find this. Although I dont know how true that is with all of the new "vibe coders" out there right now.

MeanderingProgrammer added a commit that referenced this issue Apr 1, 2025
## Details

Related to issues like
#382

We use a version check like `vim.fn.has('nvim-0.11') == 1` before adding
any `extmarks` that use version specific options like `conceal_lines`.
By doing this we avoid ever getting to the API call that adds the marks
and can add fallback behavior for certain decorations like code borders.

However this version check has to make the assumption that the user has
all the features of the released version, which should be safe for most
people. However anyone using a dev version could have built it at a time
where the version check passes but before that feature was introduced.

This should be somewhat rare as it relies on someone having a dev build
and not upgrading when a release occurs.

In the event of an error we use `vim.notify_once` to inform the user
that they should update their build or switch to the released version
while not spamming errors at them.

Minor other changes:

- use `vim.o` to get options instead of `nvim_get_option_value`
- update `colorcolumn` suggestions to use option value
@MeanderingProgrammer
Copy link
Owner

Decided to use the pcall approach with a vim.notify_once so the error isn't silent but also not too in your face: 1e2e9a3

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

No branches or pull requests

3 participants