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

Add original gem source location to RBIs #1025

Merged
merged 9 commits into from
Jul 7, 2022
Merged

Conversation

vinistock
Copy link
Member

Motivation

Tapioca knows the original location of where methods, classes and modules were defined while generating the RBIs. By including this information as comments, we can enable go to gem source using the Ruby LSP quite easily.

Implementation

The first commit adds the original method and passes it around the pipeline. The second commit creates a new listener that decorates all nodes with the original location information using the format source://GEM_NAME-GEM_VERSION/path/to/file.

We can use the DocumentLink request to connect these special URIs to the proper file system path and enable go to def.

Tests

Added tests.

@vinistock vinistock requested a review from a team June 30, 2022 17:56
@vinistock vinistock self-assigned this Jun 30, 2022
@vinistock vinistock force-pushed the group-pairing-go-to-def branch from 0dd0a48 to 0de643f Compare June 30, 2022 19:08
lib/tapioca/gem/listeners/gem_location.rb Outdated Show resolved Hide resolved
lib/tapioca/gem/listeners/gem_location.rb Outdated Show resolved Hide resolved
lib/tapioca/gem/listeners/gem_location.rb Outdated Show resolved Hide resolved
lib/tapioca/gem/listeners/gem_location.rb Outdated Show resolved Hide resolved
spec/tapioca/gem/pipeline_spec.rb Outdated Show resolved Hide resolved
spec/tapioca/gem/pipeline_spec.rb Outdated Show resolved Hide resolved
@vinistock vinistock force-pushed the group-pairing-go-to-def branch 2 times, most recently from 9e6b260 to 4d483af Compare July 4, 2022 20:01
@vinistock vinistock requested a review from paracycle July 6, 2022 15:52
spec/tapioca/gem/pipeline_spec.rb Outdated Show resolved Hide resolved
spec/tapioca/gem/pipeline_spec.rb Outdated Show resolved Hide resolved
@vinistock vinistock force-pushed the group-pairing-go-to-def branch from 4d483af to 64a2a9a Compare July 6, 2022 17:39
Copy link
Contributor

@egiurleo egiurleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome! I left a question and a couple of nitpick comments but they're not blocking.

lib/tapioca/gem/listeners/source_location.rb Outdated Show resolved Hide resolved
lib/tapioca/gem/listeners/source_location.rb Show resolved Hide resolved
@vinistock vinistock force-pushed the group-pairing-go-to-def branch from 64a2a9a to 7f71017 Compare July 7, 2022 14:32
@vinistock vinistock force-pushed the group-pairing-go-to-def branch from 7f71017 to de74e08 Compare July 7, 2022 17:52
@vinistock vinistock merged commit 55cc72f into main Jul 7, 2022
@vinistock vinistock deleted the group-pairing-go-to-def branch July 7, 2022 18:04
@shopify-shipit shopify-shipit bot temporarily deployed to production July 14, 2022 18:56 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants