solargraph
solargraph copied to clipboard
Add 'solargraph pin' command for debugging
I'm leaving this hidden until I'm a little happier with the arguments and juggling different types of pins, but this seemed useful for developers and debugging user issues:
$ bundle exec solargraph pin 'Kernel#select'
#<Solargraph::Pin::Method `name="select" return_type=Kernel#select def select: (read ::Array[::IO], ?write ::Array[::IO], ?error ::Array[::IO], ?timeout ::Time::_Timeout) -> ::Array[::String], context=::Kernel, closure=[name="Kernel" return_type=Kernel module ::Kernel, context=::Class<>, closure=[(top-level)], binder=::Module<Kernel>], binder=::Kernel` at #<Solargraph::Location /Users/broz/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/rbs-3.9.4/core/kernel.rbs, #<Solargraph::Range #<Solargraph::Position 1712, 2> to #<Solargraph::Position 1712, 122>>>) via :rbs>
broz@Mac:~/src/solargraph$ bundle exec solargraph pin --typify 'Kernel#select'
::Array<::String>
$
$ bundle exec solargraph help pin
Usage:
solargraph pin [PATH]
Options:
[--rbs], [--no-rbs], [--skip-rbs] # Output the pin as RBS
# Default: false
[--typify], [--no-typify], [--skip-typify] # Output the calculated return type of the pin from annotations
# Default: false
[--probe], [--no-probe], [--skip-probe] # Output the calculated return type of the pin from annotations and inference
# Default: false
[--stack], [--no-stack], [--skip-stack] # Show entire stack of a method pin by including definitions in superclasses
# Default: false
Describe a pin
$
I believe the build issue is related to https://github.com/castwide/solargraph/pull/970#issuecomment-3067171776
I've really been in need of this!