In Neovim the parent node is selected when cursor is on first character of a child node
I am using this parser for haskell files in neovim, and want to select the node under the cursor. I've noticed that when the cursor is on the first character of a node, the parent node is currently selected in the InspectTree window. This seems like a bug to me, but I'm not sure if its a bug in this parser or in the way that neovim is using it.
Examples :
Parent 'haskell' node selected while cursor on import statement
Parent do block is selected while the cursor is on the tidal binding
If I call vim.treesitter.get_captures_at_cursor() while the cursor is on the first character of tidal, it correctly returns { "variable" }
Can anyone help me understand why this is?
huh. That really is highly peculiar...
It appears that not all nodes are affected, so I would speculate that this is caused by some of the zero-width nodes parsed by the C extension.
If I'm reading the tree-sitter code involved in the query correctly, it only skips empty nodes when their end point is before the cursor position. My intuition is that our empty nodes would start and end at the same position as the real node, but I'll have to investigate further.