Expose require path resolution to Ruby API#555
Merged
alexcrocha merged 1 commit intomainfrom Feb 4, 2026
Merged
Conversation
a1e279c to
6f99d8c
Compare
Expose the Rust require path resolution through FFI and C bindings, allowing Ruby to resolve a require path (e.g., foo/bar) to its Document given a list of load paths. This enables go-to-definition functionality for require statements in editors.
6f99d8c to
39f23a3
Compare
Morriar
reviewed
Feb 9, 2026
| graph.index_all(context.glob("**/*.rb")) | ||
|
|
||
| load_paths = [context.absolute_path_to("lib")] | ||
| document = graph.resolve_require_path("foo/bar", load_paths) |
Contributor
There was a problem hiding this comment.
What would happen with this scenario?
context.write!("lib/foo/bar.rb", "class Bar; end")
context.write!("test/foo/bar.rb", "class Bar; end")
load_paths = [context.absolute_path_to("lib"), context.absolute_path_to("test")]
graph.resolve_require_path("foo/bar", load_paths)
Contributor
Author
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.

Follow-up to #528, and a step towards #411.
This PR adds FFI and C bindings to expose
resolve_require_pathto Ruby, returning aDocumentthat can be used directly for go-to-definition on require statements.