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

RBS Support #464

Open
castwide opened this issue Jul 24, 2021 · 13 comments
Open

RBS Support #464

castwide opened this issue Jul 24, 2021 · 13 comments

Comments

@castwide
Copy link
Owner

castwide commented Jul 24, 2021

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.

@dlealmt
Copy link

dlealmt commented Nov 30, 2021

Do you have any plans to support generating RBS files from YARD docs?

Thanks for all the work. This gem is a huge help!

@castwide
Copy link
Owner Author

@dleal-mojotech Thanks!

If I do, it will probably be based on Sord.

@wagenet
Copy link

wagenet commented Dec 15, 2021

I've been using sord with a decent degree of success.

@tmszcncl
Copy link

Any update on rbs support? rbs is working really well on rubymine and I miss it in vscode :)

@castwide
Copy link
Owner Author

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.

@skull-squadron
Copy link

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.

@castwide
Copy link
Owner Author

castwide commented Jan 2, 2023

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 (Stop using deprecated rubocop args #606).
  • The minimum Ruby requirement is now 2.6.

@gwillcox-r7
Copy link
Contributor

Any update on releasing a new cut of Solargraph with support for RBS or is this blocked on the go to definition point?

@castwide
Copy link
Owner Author

I plan to release a version with RBS support for core and stdlib first, then iterate support for gems and workspaces.

@chalmagean
Copy link

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?

@castwide
Copy link
Owner Author

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.

@chalmagean
Copy link

Gotcha. Thank you.

@mnussbaum
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants