tree-sitter-nu
tree-sitter-nu copied to clipboard
queries can't match the last pipe_element in a pipeline
I’m not sure if this is a bug in our parser or in tree-sitter.
nushell source |
tree-sitter query |
|
|
With the tree-sitter cli:
> tree-sitter query -c query.scm source.nu
source.nu
pattern: 0, capture: 0 - first, start: (0, 2), end: (0, 3), text: `1`
pattern: 1, capture: 1 - last_, start: (0, 2), end: (0, 3), text: `1`
pattern: 1, capture: 1 - last_, start: (1, 2), end: (1, 3), text: `2`
pattern: 1, capture: 1 - last_, start: (2, 2), end: (2, 3), text: `3`
Within neovim:
| First | Last |
|---|---|
I have filed an issue.
Appears to be a tree-sitter bug that happens to be triggered by our "crazy" grammar.
It's really weird in my opinion, query matching is supposed to be based purely on the parsing results, and parser agnostic. Yet it does behave inconsistently between nushell and others.
The bug was initially introduced by #139 . Maybe it has something to do with newline characters.