neovim / tree-sitter-vimdoc

Tree-sitter parser for Vim help files
Apache License 2.0
97 stars 13 forks source link

fix: parse arguments properly in certain circumstances #103

Closed amaanq closed 1 year ago

amaanq commented 1 year ago

Closes #102

Didn't test everything imaginable, but the ones linked in the issue parse fine now

vim.foo({bar})

vim.foo( {bar})

nvim_foo({bar})

nvim_foo({bar},{baz})

nvim_foo({bar}, {baz})

image

clason commented 1 year ago

Hmm, that fails two tests (tree-sitter test, or make all).

amaanq commented 1 year ago

that failing would make sense, i'll update the tests accordingly :) but idk why CI didn't catch that

amaanq commented 1 year ago

Seems like that might've fixed one of the tests anyways

clason commented 1 year ago

but idk why CI didn't catch that

because you didn't push the generated parser.c?

clason commented 1 year ago

I think you also need to add [ (see, e.g., :h nvim_buf_detach_event).

clason commented 1 year ago

And can you add a new test for these?

amaanq commented 1 year ago

done

clason commented 1 year ago

Wait, you added a scanner? I was hoping we could fix this without introducing one; this is a larger change than I am comfortable with.

amaanq commented 1 year ago

Shoot, idk how that got added, that was from a different parser...whoops :sweat_smile: (nvm that was from just playing around a bit)

clason commented 1 year ago

Phew ;)

clason commented 1 year ago

This adds a regression in indent.txt (:h ft-sh-indent) around

b:sh_indent_options['default']  Default amount of indent.

The 'default' is now recognized as a optionlink. (But not the lines below, curiously -- because they have a dash in them.)

There's also a few other regressions in taglinks, such as :h v_aB in motion.txt and |,| in map.txt (while most of them can be fixed by changing the help file, this cannot, so it's a blocker).

amaanq commented 1 year ago

Added another ugly hack for it, lmk of any others oddities

clason commented 1 year ago

Still breaks the taglink in map.txt.

amaanq commented 1 year ago

This flew off the radar...what's the taglink in map.txt? I'm unfamiliar with vimdoc semantics

clason commented 1 year ago

|,| (which is a link to the tag for ,).

justinmk commented 1 year ago

Will revisit/rebase this after https://github.com/neovim/tree-sitter-vimdoc/pull/97

justinmk commented 1 year ago

Rebased in https://github.com/neovim/tree-sitter-vimdoc/pull/108