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

Develop strategy for indexing declarations made in C / native extensions #1335

Closed
7 tasks done
vinistock opened this issue Jan 29, 2024 · 4 comments
Closed
7 tasks done
Assignees
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale

Comments

@vinistock
Copy link
Member

vinistock commented Jan 29, 2024

We currently index all Ruby files bundled with the Ruby installation, but that doesn't cover all declarations available. Core classes like Array or String are defined in C and thus we miss those declarations. We also miss gem declarations that are made in native extensions.

We need to consider the performance, accuracy and maintenance costs of a few different approaches to decide how we're going to handle this:

  • RDoc uses regexes to extract declarations from C files directly. The problem with that is that the C files aren't always included in Ruby installations, so those files may not be there
  • We could read the RDoc index objects, but that is also dependent on the installation since Ruby may be installed without documentation
  • We can read and process RBS files. However, we'll miss gems that don't include RBS signatures
  • We could also bundle empty declarations for the Core library in Ruby files, which is essentially what RBS signatures are. This would involve some manual work to create these files and we would need to ensure they are up to date based on Ruby versions
  • Some other idea?

Tasks

  1. st0012
  2. st0012
  3. Stale
  4. andyw8
@vinistock vinistock added the enhancement New feature or request label Jan 29, 2024
Copy link
Contributor

This issue is being marked as stale because there was no activity in the last 2 months

@github-actions github-actions bot added the Stale label Mar 30, 2024
@vinistock vinistock added pinned This issue or pull request is pinned and won't be marked as stale and removed Stale labels Apr 1, 2024
@andyw8
Copy link
Contributor

andyw8 commented Jun 3, 2024

As per the team discussion earlier today, we will move ahead with using RBS declarations for indexing core class (String, Integer, etc).

@andyw8 andyw8 self-assigned this Jun 3, 2024
@vinistock
Copy link
Member Author

This branch includes a super simple script for how to retrieve declarations which I paired on with Soutaro during RubyKaigi.

My understanding of it is that we can basically just iterate over the declarations that the code returns and then build our index's entries and push them.

@andyw8
Copy link
Contributor

andyw8 commented Jun 6, 2024

I've updated the description with tasks related to RBS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

2 participants