Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.33k stars 118 forks source link

Support symbol procs in definition #1982

Closed vinistock closed 2 weeks ago

vinistock commented 2 weeks ago

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.