Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Sibling nodes and quantifiers #3

Open
vigoux opened this issue Aug 10, 2020 · 7 comments
Open

Sibling nodes and quantifiers #3

vigoux opened this issue Aug 10, 2020 · 7 comments

Comments

@vigoux
Copy link
Member

vigoux commented Aug 10, 2020

Hey, I was playing a bit with the playground, it is really nice !

Though I encountered issues with the following query :

("function" @id "end" @id)
((comment)+ @doc . (function))
  1. Putting the cursor on the first @id does not do anything.
  2. Putting the cursor on @doc only highlights the very last comment before a function, while it should highlight the group of comments before the function.

By the way, the first match does not seem to be parsed correctly.

@steelsojka
Copy link
Collaborator

The first issue seems to be an issue with the grammar. The string is getting greedy. I'll fix that in the grammar. I'll check what matches we are getting back for the comment query. Also, the immediate child operator isn't supported yet by the grammar (but treesitter should still accept it). I'll have something for that soon.

@steelsojka
Copy link
Collaborator

steelsojka commented Aug 10, 2020

@vigoux After researching the second issue, it seems to be a problem with iter_prepared_matches in nvim-treesitter. It only gives us the first node. I will submit a PR to fix it.

EDIT: Actually I think this is a problem in nvim core. The treesitter api only gives us one matched node.

@vigoux
Copy link
Member Author

vigoux commented Aug 10, 2020

Oh, nice catch then, was worth looking into.

@steelsojka
Copy link
Collaborator

@vigoux The second one seems to be in the tree sitter api in nvim. It only gives us one node of the match.

@vigoux
Copy link
Member Author

vigoux commented Aug 10, 2020

That's interesting
Raise the issue in nvim, so that we continue the discussion there, will work on this later.

@steelsojka
Copy link
Collaborator

@vigoux I'll fix the first issue. I want to get a simple reproduction before I submit an issue in nvim.

@steelsojka
Copy link
Collaborator

tree-sitter-grammars/tree-sitter-query#2 Fixes the string issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants