Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruby "operator" instance methods query #292

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

Slotos
Copy link
Contributor

@Slotos Slotos commented Sep 18, 2023

Ruby supports some operators overloading by declaring a method with the operator as the method name, e.g. def <=>(other). Tree sitter ruby parser recognises these method names as operators, not identifiers, and as such existing queries skip over them.

This commit adds a query that captures "operator" instance methods.

Closes #291

Ruby supports some operators overloading by declaring a method with the
operator as the method name, e.g. `def <=>(other)`. Tree sitter ruby
parser recognises these method names as operators, not identifiers, and
as such existing queries skip over them.

This commit adds a query that captures "operator" instance methods.
@Slotos
Copy link
Contributor Author

Slotos commented Sep 18, 2023

A screenshot of a tree from the test file
image

@stevearc
Copy link
Owner

Thanks for the PR!

@stevearc stevearc merged commit fa8c408 into stevearc:master Sep 18, 2023
7 checks passed
@Slotos Slotos deleted the add-ruby-operator-methods-query branch September 18, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Ruby] Operator defining methods aren't getting discovered
2 participants