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

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

Open
edte opened this issue Aug 13, 2024 · 18 comments
Open

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

edte opened this issue Aug 13, 2024 · 18 comments

Comments

@edte
Copy link

edte commented Aug 13, 2024

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
Copy link
Owner

OXY2DEV commented Aug 13, 2024

I am not getting any errors though?

Can you send a screenshot?

@taiwithers
Copy link

taiwithers commented Aug 16, 2024

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
Copy link
Owner

OXY2DEV commented Aug 16, 2024

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

taiwithers commented Aug 16, 2024

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
Copy link
Owner

OXY2DEV commented Aug 16, 2024

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

@taiwithers
Copy link

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

Any help command will cause the error for me.

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 16, 2024

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

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
Copy link
Owner

OXY2DEV commented Aug 16, 2024

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

@taiwithers
Copy link

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

image

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 17, 2024

Which help file did you open?

I need it to check what is on that line.

@taiwithers
Copy link

taiwithers commented Aug 17, 2024

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
Copy link
Owner

OXY2DEV commented Aug 18, 2024

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

: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.

Recording.2024-08-17.224711.mp4

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 18, 2024

I have found the issue.

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

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 18, 2024

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
Copy link
Owner

OXY2DEV commented Aug 18, 2024

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

@taiwithers
Copy link

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.

@OXY2DEV OXY2DEV changed the title attempt to index local 'heading' (a nil value) Vimdoc parser without PR#134 causes heading=nil Aug 18, 2024
@OXY2DEV OXY2DEV pinned this issue Aug 18, 2024
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

No branches or pull requests

3 participants