docs: advertise Hybrid LSP support for Ruby - #1713
Open
benrfairless wants to merge 4 commits into
Open
Conversation
In-process, type-aware call resolution for single Ruby files, mirroring the perl_lsp.c / php_lsp.c shape and dispatched from cbm_extract_file: - PASS 1 collects classes and modules with lexical nesting, superclasses, and include / prepend / extend mixins, plus method tables with instance and singleton methods classified from the AST. Singleton methods key on "<class_qn>.self", which cannot collide with a constant path. - PASS 1.5 infers instance-variable types from `@x = Const.new`; conflicting assignments latch to no type rather than guessing. - PASS 2 resolves constructors (`Const.new` targets the class node, the way Python's lsp_constructor does), implicit and explicit self dispatch, singleton methods, superclass chains, mixin lookup in Ruby's method-resolution order, super, and ivar / local / chained receivers. The stdlib seed covers Ruby core plus a curated Rails surface, including ActiveRecord query typing: `User.find(1)` is a User, and relation chains keep the model type. Dynamic dispatch (send, method_missing, define_method) and unresolved receivers emit no edge, and only project-defined targets are emitted. Cross-file resolution is a separate tier and is not part of this change; the 18 rows here drive the resolver through cbm_extract_file exactly as the extraction pipeline calls it. PROVENANCE: this resolver was authored clean-room from the tree-sitter-ruby grammar and Ruby language semantics. No Ruby language server source was consulted. scripts/check-lsp-originality.sh gains Shopify's ruby-lsp (MIT) as the Ruby reference so the boundary is auditable alongside the generated data it guards; `check-lsp-originality.sh --lang ruby` reports CLEAN — no verbatim string or comment overlap and no structural clones. Refs DeusData#1701 Assisted-by: OpenCode:anthropic/claude-opus-5 Signed-off-by: Ben Fairless <ben@oaf.org.au>
Adds the cross-file tier on top of the per-file resolver. cbm_run_ruby_lsp_cross builds its class table from the project-wide CBMLSPDef[], deriving each constant path by stripping the def's module QN prefix, and registers methods on both the instance and singleton receiver keys because CBMLSPDef does not carry the `def self.m` split. Ruby is registered on the fallback cbm_pxc_run_one path, like Java and Kotlin — there is no prebuilt tier-2 registry yet. Ruby also joins Rust in bypassing the own+imports module-def filter, for a different reason: Ruby constants live in one global namespace and Rails/Zeitwerk autoloads them with no require statement, so a filter keyed on requires would starve essentially all cross-file resolution in a real Ruby app. That exemption is the one deliberate design decision here. The two new rows drive cbm_run_ruby_lsp_cross with a hand-built CBMLSPDef[] in the shape pass_lsp_cross.c passes it, the second mirroring the Rails-shaped e2e fixture (User < ApplicationRecord < ActiveRecord::Base, a service object, and a caller in a third file). Refs DeusData#1701 Assisted-by: OpenCode:anthropic/claude-opus-5 Signed-off-by: Ben Fairless <ben@oaf.org.au>
Ruby joins the Hybrid LSP cohort in the README: the badge moves from 10 to 11 language families (C and C++ count as one, as they already did), Ruby is added to both prose language lists, and the capability table gains a Ruby row. Every capability the row names is backed by a row in the Ruby suite that landed in the preceding two commits — lexical nesting and `A::B` resolution, superclass chains, include / prepend / extend in Ruby's method-lookup order, the `def self.m` singleton split, `Const.new` constructor typing, self dispatch, super, instance-variable typing, ActiveRecord query typing, and the zero-edge guarantee for the dynamic-dispatch family and unresolved receivers. This lands last on purpose: the cross-file claims are only true once the cross-file tier is wired, so the documentation follows the slice that establishes the advertised level rather than preceding it. docs/index.html is deliberately untouched. Its structured data carries a pre-existing error (nine language families, Perl omitted) that predates this work; correcting it belongs in its own change rather than being folded into a feature PR. Resolves DeusData#1701 Assisted-by: OpenCode:anthropic/claude-opus-5 Signed-off-by: Ben Fairless <ben@oaf.org.au>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
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.
What does this PR do?
Slice 5 of 5 splitting #1706. Stacked on #1712 — see the review note below.
Ruby joins the Hybrid LSP cohort in the README: the badge moves from 10 to 11 language families (C and C++ count as one, as they already did), Ruby is added to both prose language lists, and the capability table gains a Ruby row.
This lands last on purpose. The review asked that documentation ship with the slice that actually establishes the advertised support level, and the row's cross-file claims — ActiveRecord model typing across files, superclass chains that span files — are only true once #1712 is in.
Every claim in the row is backed by a test
While writing this I audited the row against the suite and found three capabilities named but untested:
prepend,method_missinganddefine_method. All three are genuinely implemented, but advertising untested behaviour is exactly what this split is meant to prevent, so rather than weaken the wording I added coverage to #1711:rubylsp_prepend_mixin— a prepended module shadows the class's own method, and the shadowed method is not also emitted. Both methods exist in the fixture, so a resolver that walked the class first would still emit an edge, just the wrong one.rubylsp_dynamic_dispatch_family_no_edge—public_send,__send__,define_methodandinstance_evaleach emit no edge (sendalready had its own row).What this PR deliberately does not touch
docs/index.htmlis left alone. Its structured data carries a pre-existing error — it says nine language families and omits Perl, both wrong before this work started. The Ruby edits would land on those exact strings, so adding Ruby without correcting them would mean authoring a sentence I know to be wrong, and correcting them here would mix an unrelated fix into a feature PR. It wants its own change; happy to file it.Reviewing just this slice
A PR from a fork can only target a branch in this repo, so the base is
mainand GitHub shows #1711 and #1712's commits too. Onlyaf9e6200is this slice — a 4-line README change. Merge the parents and the diff collapses to it.Where this sits in the series
CI baseline
mainat 4d7d9f1 is red for reasons unrelated to this change (#1181 × #1359 composition; fixed by #1704). Until that merges,ci-okwill be red here for that reason.Resolves #1701
Checklist
git commit -s)scripts/test.sh) — see fix(extraction): keep Ruby superclass names bare #1709 for the full-leg numbers; all failures are pre-existing on unmodifiedorigin/main.make -f Makefile.cbm lint-ci)Assisted by OpenCode using anthropic/claude-opus-5.