OXY2DEV / helpview.nvim

Decorations for vimdoc/help files in Neovim
Apache License 2.0
154 stars 1 forks source link

Vimdoc parser without `PR#134` causes `heading=nil` #4

Open edte opened 1 month ago

edte commented 1 month ago

when exec h fold-manual it failed

Error executing lua callback: ...site/pack/lazy/opt/helpview.nvim/lua/helpview/parser.lua:68: attempt to index local 'heading' (a nil value)
stack traceback:
        ...site/pack/lazy/opt/helpview.nvim/lua/helpview/parser.lua:68: in function 'vimdoc'
        ...site/pack/lazy/opt/helpview.nvim/lua/helpview/parser.lua:359: in function 'fn'
        ...6/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:473: in function 'for_each_tree'
        ...site/pack/lazy/opt/helpview.nvim/lua/helpview/parser.lua:355: in function 'init'
        ...arvim/site/pack/lazy/opt/helpview.nvim/ftplugin/help.lua:75: in function <...arvim/site/pack/lazy/opt/helpview.nvim/ftplugin/help.lua:32>
OXY2DEV commented 1 month ago

I am not getting any errors though?

Can you send a screenshot?

taiwithers commented 1 month ago

Here is my (debugging) init.lua with the error that occurs when I do :h (or any other help command). I'm not using any particular plugin manager, just using Nix/Home Manager to place the plugin downloads the vim path.

image

However using a modified version of the minimal init.lua provided by noice, I am able to open help files without any issues and helpview is active.

OXY2DEV commented 1 month ago

However using a modified version of the minimal init.lua provided by noice, I am able to open help files without any issues and helpview is active.

Are you sure you don't have some other plugin that works on help files?

taiwithers commented 1 month ago

Are you sure you don't have some other plugin that works on help files?

It doesn't appear to be that - running nvim with the following init.lua still generates the same error, and presumably no other plugins are being loaded (using nvim -u helpview-init-nolazy.lua)

require('helpview').setup()

It may be useful to know that this doesn't block the help file from opening, but the error is persistent (and with a notification plugin such as noice, this is pretty annoying)

OXY2DEV commented 1 month ago

It only happens on :h fold-manual, right?

taiwithers commented 1 month ago

It only happens on :h fold-manual, right?

Any help command will cause the error for me.

OXY2DEV commented 1 month ago

That is so strange. Even with the minimal init.lua I still can't reproduce the issue.

What neovim version are you using?

Also did you update the plugin?

taiwithers commented 1 month ago

What neovim version are you using?

image

Also did you update the plugin?

I'm using commit 336d731

I don't have any lua experience so apologies if I can't provide much assistance here.

OXY2DEV commented 1 month ago

Can you manually add vim.print(row_start) before this line and see what gets printed?

taiwithers commented 1 month ago

Can you manually add vim.print(row_start) before this line and see what gets printed?

image

OXY2DEV commented 4 weeks ago

Which help file did you open?

I need it to check what is on that line.

taiwithers commented 4 weeks ago

Which help file did you open?

In the above screenshot, I was doing :h so it gives 40, 43, 60 :h nvim gives the rows 21, 72 :h fold-manual gives the rows 13, 273, 463, 576, 617

OXY2DEV commented 4 weeks ago

That is very strange.

Screenshot_2024-08-18-08-10-43-470_com termux-edit

What does :InspectTree show on these lines?

You may additionally want to run :TSUpdate to see if anything is out of date.

Anyway, you can just do :h, 40j & run :InspectTree and see if it looks any different than my screenshot.

taiwithers commented 4 weeks ago

:TSUpdate says all parsers are up to date

Here's a screen recording of running that set of commands and it does land on an h1 element, though I have no idea why unless we're somehow looking at different help files.

https://github.com/user-attachments/assets/1e36683d-a619-4572-98f4-6a7d06290539

OXY2DEV commented 4 weeks ago

I have found the issue.

You treesitter shows (word) (word). It should be showing (delimiter) (heading).

OXY2DEV commented 4 weeks ago

There's definitely something wrong with the parser you are using (headings should be highlighted even without the plugin, which isn't the case in the video).

OXY2DEV commented 4 weeks ago

You most likely don't have this PR in your parser.

taiwithers commented 4 weeks ago

Yup, nixpkgs has nvim-treesitter rev 8012b55, which pulls vimdoc b711df (as per their lockfile.json), one commit before that PR is merged. So looks like myself and anyone else having issues with this need to be on at least nvim-treesitter rev 69341a2.