Skip to content

Conversation

@gbroques
Copy link
Contributor

@gbroques gbroques commented Jul 28, 2025

The query handles methods with a typical return as you'd expect.

class Example {
  private String example() {
    return "example";
  }
}

I made the wildcard child node optional (_)? in the query so @return.outer matches void returns:

class Example {
  private void example() {
    return;
  }
}

gbroques added a commit to gbroques/dotfiles that referenced this pull request Jul 28, 2025
@gbroques
Copy link
Contributor Author

gbroques commented Jul 28, 2025

I think the same commit can be applied to the main branch.

I'm happy to submit another PR for that, or leave that to the maintainers. (@kiyoon @clason)

@kiyoon
Copy link
Collaborator

kiyoon commented Jul 28, 2025

Is this a feature or a fix?

@kiyoon
Copy link
Collaborator

kiyoon commented Jul 28, 2025

Please do not modify the Readme yourself. It's automatic.

@gbroques gbroques force-pushed the feat-java-add-return-textobjects branch from 6585047 to 2061cce Compare July 29, 2025 01:46
@gbroques
Copy link
Contributor Author

gbroques commented Jul 29, 2025

@kiyoon Thank you for your prompt response, and comments.

Is this a feature or a fix?

I consider it a feature since it's adding functionality that wasn't there.

@return.* text objects aren't documented as supported by Java in the README, so I wouldn't consider adding support a "fix".

I'm happy to change my commit to a "fix" if you think it's more appropriate though.

Please do not modify the Readme yourself. It's automatic.

Thanks! I didn't realize that. I amended my commit to remove the README change.

@kiyoon
Copy link
Collaborator

kiyoon commented Jul 29, 2025

Ok, I thought you made some node optional but it was a confusion on my end. That's a feature indeed.

@gbroques
Copy link
Contributor Author

gbroques commented Jul 29, 2025

Ok, I thought you made some node optional but it was a confusion on my end. That's a feature indeed.

@kiyoon Awesome, well let me know if there's anything else I can do.

It looks like certain checks are failing for reasons not introduced by this change.

I update the original PR description so it's hopefully more clear to anyone in the future.

Thanks again!

@kiyoon kiyoon merged commit 71385f1 into nvim-treesitter:master Jul 29, 2025
3 of 6 checks passed
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.

2 participants