Proposal: Extend `ruby-rbs` crate features

Offen
#2,954 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Ruhig
Tech-Stack
ruby, rust
Bereich
devtools

Rechercherichtung

Beginne mit der Durchsicht des vorhandenen ruby-rbs-Crates und der entsprechenden höheren Schichten im rbs gem. Der Vorschlag umfasst TypeName/Namespace, EnvironmentLoader, Environment und DefinitionBuilder. Bestimme daher zunächst, welche Schicht und welchen Umfang das Projekt akzeptieren wird. Erledigt wäre die Aufgabe erst mit einer abgestimmten Rust-Schnittstelle und einem Implementierungsplan, nicht mit einer einzelnen isolierten Änderung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Motivation

The ruby-rbs crate currently provides only the parser layer (AST + Visit trait).
The rbs gem, in contrast, ships several higher-level layers on top of the parser — environment construction, name resolution, and definition (ancestor / method) resolution.

Until those layers exist on the Rust side, downstream tooling (type checkers, LSP servers, code generators) cannot be built using ruby-rbs alone. This issue proposes to gradually port those upper layers into the crate.

Features I want

I'm building a static type checker in Rust for my own gem.
Currently, RBS type definitions are loaded on the Ruby side and the result is then handed over to Rust for analysis.
I'd like to move the loading step into Rust as well, so the whole pipeline can be driven through a Rust interface — which requires the following layers in ruby-rbs:

  • TypeName / Namespace — structured type names like ::Foo::Bar; prerequisite for every layer below
  • EnvironmentLoader — discovering .rbs files from gem paths / libdirs, equivalent to rbs gem's loader
  • Environment — merging declarations from multiple files (class reopens, module aliases) and exposing a lookup API
  • DefinitionBuilder — resolving inherited methods via MRO so callers can ask "what methods does Foo::Bar expose?" without re-implementing ancestor traversal in every consumer

Of course, things won’t always go as planned.

Willingness to contribute

If the RBS core team is planning to expand ruby-rbs with these upper layers, I'd love to contribute actively — not just file this as a wishlist.

Vorherrschende Sprache
Ruby
Sterne
2.2k
Forks
263
Ø Merge
1 T. 20 Std.
Gemergte PRs (30 T.)
64

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ruby/rbs

Alle Issues in ruby/rbs

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.