tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
152 stars 36 forks source link

scanner counts newlines multiple times #31

Closed tek closed 3 years ago

tek commented 3 years ago

In the wake of neovim merging support for TS 0.19, I am getting back to it.

First thing I noticed is that the line numbers are off – certain scanner results cause the line number to be incremented by two when parsing a newline. I am fiddling around with how these get emitted in the scanner, so far it's still unclear to me what the exact reason is; the only thing I achieved so far is that they are counted even more times.

As far as I can tell, there are these factors:

@maxbrunsfeld Would greatly appreciate some advice!

maxbrunsfeld commented 3 years ago

I think that this may be the same bug described here: https://github.com/tree-sitter/tree-sitter/issues/589.

It is fixed in the master branch of Tree-sitter, via https://github.com/tree-sitter/tree-sitter/pull/978.I don't know if Neovim has upgraded to use this version.

maxbrunsfeld commented 3 years ago

Maybe check with the latest version of Tree-sitter if you can reproduce the incorrect row numbers outside of the context of Neovim.

tek commented 3 years ago

oh wow! I updated tree-sitter a few days ago, will check if that was right before

tek commented 3 years ago

scratch that, I updated neovim, not tree-sitter

tek commented 3 years ago

that did indeed fix the problem! :partying_face: