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 line numbers to the ConstantDefinition tracker #1029

Merged
merged 2 commits into from
Jul 4, 2022

Conversation

vinistock
Copy link
Member

Motivation

Based on this suggestion.

We need the line numbers where constants were defined in order to add the original gem source locations for jump to definition. This PR saves this information in the ConstantDefinition tracker.

Implementation

Added a T::Struct to keep track of path and line number, started populating it in the tracker and used the new method in the only occurrence of files_for.

Tests

I contemplated adding a new test only for this tracker, but noticed that's not a pattern we're using in tests. Should I create a new one for this tracker?

@vinistock vinistock requested a review from a team July 4, 2022 18:06
@vinistock vinistock self-assigned this Jul 4, 2022
Copy link
Member

@paracycle paracycle left a comment

Choose a reason for hiding this comment

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

I am ok accepting this without a test since it is relatively hard to test it properly (since we would have to setup multiple Ruby files, etc) and there isn't that much logic in the tracker in the first place.

lib/tapioca/gem/pipeline.rb Outdated Show resolved Hide resolved
@vinistock vinistock force-pushed the vs/add_line_number_to_constant_tracker branch from b3fa24b to ca88a66 Compare July 4, 2022 18:47
@vinistock vinistock merged commit 305bb6b into main Jul 4, 2022
@vinistock vinistock deleted the vs/add_line_number_to_constant_tracker branch July 4, 2022 20:00
@shopify-shipit shopify-shipit bot temporarily deployed to production July 7, 2022 17:53 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to 0-9-stable August 19, 2022 20:37 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.

None yet

3 participants