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

Support symbol procs in definition #1982

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Conversation

vinistock
Copy link
Member

Motivation

Allow jumping to the definition of method calls passed as symbol proc arguments (e.g.: map(&:to_i)).

Implementation

  1. Started accepting Prism::BlockArgumentNode as a possible target to locate
  2. Started handling that node type in the definition listener
  3. Made a small refactor to make the method definition helper more reusable

Automated Tests

Changed the example from #1981 to assert the right positions.

@vinistock vinistock added enhancement New feature or request server This pull request should be included in the server gem's release notes labels Apr 26, 2024
@vinistock vinistock self-assigned this Apr 26, 2024
@vinistock vinistock requested a review from a team as a code owner April 26, 2024 18:08
@vinistock vinistock requested review from andyw8 and st0012 April 26, 2024 18:08
Base automatically changed from vs/make_method_call_targeting_more_precise to main April 26, 2024 18:10
@vinistock vinistock force-pushed the vs/support_block_method_symbols branch from f34194a to 1373806 Compare April 26, 2024 18:11
Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified it also works when the symbol-to-proc isn't the only argument, e.g. values.inject(0, &:foo).

@vinistock vinistock merged commit 18ba05b into main Apr 29, 2024
42 checks passed
@vinistock vinistock deleted the vs/support_block_method_symbols branch April 29, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants