solargraph
solargraph copied to clipboard
RBS Support
Integration of RBS into Solargraph is officially on the roadmap.
Features
- Map the Ruby core and stdlib with RBS
- Map gems with RBS when sigs are available
- Fall back to YARD for gems that do not provide sigs
Pros
- Ostensibly faster. In my early experiments, mapping from RBS instead of YARD appears to provide a slight performance boost.
- Better support. Updates to core and stdlib signatures are likely to be more frequent and more accurate.
-
No need for core docs. It will no longer be necessary to use
solargraph download-core
to update core and stdlib documentation. - YARD will continue to be supported. RBS sigs will be treated as the canonical authority for external libraries when they're available, but Solargraph will still use YARD annotation in workspace maps.
Cons
- Requires Ruby 2.6+. Solargraph currently supports Ruby 2.4+. With integration of RBS, 2.6 will become the minimum requirement.
- Major rearchitecture. The concepts of maps and pins will undergo a thorough redesign.
- Missing features. Some code intelligence provided by YARD may not be currently available in RBS. One known example: RBS does not support protected methods.
Current progress can be previewed on the repo's rbs
branch.
Do you have any plans to support generating RBS files from YARD docs?
Thanks for all the work. This gem is a huge help!
I've been using sord with a decent degree of success.
Any update on rbs support? rbs is working really well on rubymine and I miss it in vscode :)
It's still in progress. I just updated the rbs
branch with a few commits I hadn't pushed yet. I can't give an exact ETA yet, but certainly before the end of the year.
steep seems to be the way things are going with rbs. I use RubyMine at home but work uses something resembling VSCode. I like the idea of rbs but I'm honestly wondering if there should've been a language break at 3 to support gradual typing like Crystal and Python.
The rbs
branch is merged into master
and will be released shortly. Some notes on the current version:
- The core and stdlib maps are generated from RBS. This means it is no longer necessary to download or generate core documentation.
- Support for RBS is not implemented in gems and workspaces yet. This is a little trickier for several reasons. One major issue is that RBS does not inherently support code locations, so features like
go to definition
would either stop working or point to the RBS definition instead of the code. I'm currently looking into possible hybrid solutions. - The deprecated RuboCop args are fixed (#606).
- The minimum Ruby requirement is now 2.6.
Any update on releasing a new cut of Solargraph with support for RBS or is this blocked on the go to definition
point?
I plan to release a version with RBS support for core and stdlib first, then iterate support for gems and workspaces.
It looks like v0.49.0 prints the following message on solargraph bundle
.
The `bundle` command is deprecated. Solargraph currently uses RBS instead.
There doesn't seem to be any info on what that means (or what to do about it). Is there any documentation available?
Running solargraph bundle
should no longer be necessary. I left it as a noop to avoid breaking existing workflows.
For problems specific to Rails, try installing the solargraph-rails plugin first.
Gotcha. Thank you.
Is it possible to update solargraph's RBS dependency to something in the RBS 3.x series? That would make packaging solargraph for arch linux, a rolling release distro, much easier. Thanks!