Using solargraph, can popup documentation for Psych.safe_load, but not for Psych.safe_dump
Using solargraph 0.54.5 with zed. Example code:
#!/usr/bin/env ruby
require 'psych'
Psych.safe_load('--- foo')
puts(Psych.safe_dump('foo'))
- Hovering over
Psychcorrectly shows the module documentation - Hovering over
safe_loadcorrectly shows the documentation for the save_load method - Hovering over
safe_dumpdoes nothing. Additionally, safe_dump does not show up in completion popups, even though the function exists (Running Ruby 3.4.4 on Arch Linux. using system-wide psych.rb in/usr/lib/ruby/3.4.0/psych.rbwhich is part of therubypackage on Arch Linux)
Why does solargraph act as if safe_dump does not exist?
Why does solargraph act as if safe_dump does not exist?
Looks like Ruby's RBS types don't include that method :(
https://github.com/ruby/rbs/blob/36e53a2a75f90356d2410c522da31a4171a8fbbe/stdlib/psych/0/psych.rbs#L46
We don't currently parse Ruby core/stdlib source, just gems - so if it's not in the RBS, solargraph doesn't currently pick it up. Even if we did, the Ruby source doesn't include type information, so getting this into the rbs repo would be the ideal fix.
Alright, so should I file a bug on RBS? I'm not sure how the ruby ecosystem handles this normally..
That'd fix it for sure. rbs is a gem from this GitHub repo: https://github.com/ruby/rbs/blob/master/docs/CONTRIBUTING.md