Display RBS type signatures in documentation#1665
Draft
st0012 wants to merge 2 commits intosignature-card-designfrom
Draft
Display RBS type signatures in documentation#1665st0012 wants to merge 2 commits intosignature-card-designfrom
st0012 wants to merge 2 commits intosignature-card-designfrom
Conversation
Collaborator
|
🚀 Preview deployment available at: https://c26bfbb0.rdoc-6cd.pages.dev (commit: bfcd437) |
251f5db to
be86678
Compare
RBS 4.0 requires Ruby >= 3.2. Bump RDoc's own minimum to match and add `rbs >= 4.0.0` as a gemspec dependency. Bump prism minimum to `>= 1.6.0` (required by rbs). Drop JRuby and TruffleRuby from CI matrix (rbs has a C extension that cannot build on them).
d25f6ba to
a469122
Compare
Add `type_signature` accessor to `MethodAttr`. During Prism parsing, extract `#:` annotation lines from comment blocks and store them on methods and attributes. Bump Marshal to v4 for RI serialization. Render type signatures in the aliki theme with server-side type name linking via `RbsSupport.signature_to_html`. Uses the RBS parser to extract type name locations precisely for linking to documentation pages. Validate annotations through `RBS::Parser` — invalid sigs emit a warning but are still displayed. Load additional signatures from `sig/` directories and RBS core types via `RBS::EnvironmentLoader`. Display type signatures in `ri` terminal output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract
#:inline RBS annotations from comments and display them alongside method/attribute documentation in RDoc's HTML output.#:annotation lines from comment blocks during Prism parsing, store astype_signatureonMethodAttrsig/directory and RBS core types viaRBS::EnvironmentLoader(inline annotations take priority)RBS::Parserwith warnings for invalid syntaxriterminal outputrbs >= 4.0.0as a gemspec dependency, bump minimum Ruby to 3.2Builds on #1669 (signature card design).
Screenshots
Implementation
type_signatureaccessor onMethodAttr, Marshal v4extract_type_signature!inPrismRuby, validates via bothparse_method_typeandparse_typeRDoc::RbsSupport.load_signaturesviaRBS::EnvironmentLoader, merged afterstore.completeRbsSupport.signature_to_htmlusing RBS parser AST locations, decoupled from generator via blockrender_method_type_signatureinri/driver.rbStore#type_name_lookupbuilt once, invalidated oncompleteFollow-up work