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

Support C-method source in show_source command #664

Open
st0012 opened this issue Aug 2, 2023 · 4 comments
Open

Support C-method source in show_source command #664

st0012 opened this issue Aug 2, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@st0012
Copy link
Member

st0012 commented Aug 2, 2023

The main challenge of this support comes from acquiring the C-method source files:

  • Unless users install Ruby with ruby-install or ruby-build -k, Ruby's C source code wouldn't be preserved after Ruby is built
  • Between ruby-install and ruby-build -k, the location of sources are different:
    • ruby-install: ~/src or /usr/local/src for the root user
    • ruby-build -k: ~/.cache
  • Pry uses pry-doc to serve as an installable source database

So instead of relying on the installed CRuby source, downloading the source later may be a better approach (proposed by @k0kubun).

Questions:

  • Should it be rdoc, irb, or another tool's responsibility to perform this action?
  • Should it install multiple Ruby versions' sources, or just 1?
    • I prefer the former, like downloading all actively maintained Ruby versions at once
  • TBD
@st0012 st0012 added the enhancement New feature or request label Aug 2, 2023
@st0012
Copy link
Member Author

st0012 commented Jun 17, 2024

We may use rbs to get information for core classes/modules/methods like ruby-lsp does. However, rbs doesn't support JRuby so the implementation needs to be conditional.

@headius
Copy link
Contributor

headius commented Jun 17, 2024

It should not require significant changes to JRuby to support rbs type information for core classes. The information is all available in the JRuby .class files and .jar file.

In addition, the currently-running JRuby's sources can always be fetched from Maven Central and used to extract the Java sources of those core methods.

@st0012
Copy link
Member Author

st0012 commented Jun 17, 2024

To make sure we're talking about the same thing: what I'm referring to is that the rbs gem won't compile with JRuby as described here. I thought it needs to be resolved from the rbs side?

@headius
Copy link
Contributor

headius commented Jun 17, 2024

@st0012 The last few comments on that issue describe the path forward more clearly. You are correct that JRuby does not support the rbs native extension (JRuby does not support the CRuby extension API at all) but @soutaro mentioned in that issue that there's some work going on to make a pure-Ruby parser to eliminate this issue. When that is available, rbs should work fine on JRuby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants