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

Filter instance variable owners before deduping #2153

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

vinistock
Copy link
Member

Motivation

I noticed that I wasn't seeing as many instance variable completion candidates as I expected. The reason is because the order of operations were inverted.

Since we can have the same instance variable name exist multiple times, but belong to different owners, we need to first filter based on owner to find the ones that belong to the type we're searching for and then dedup the names to avoid showing duplicates.

If we do it the other way around, when we run uniq! we may be discarding the instance variable entry that belongs to the owner we're searching for - and thus we find no matches.

Implementation

Just switched the order.

Automated Tests

Added a test that demonstrates the bug.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jun 10, 2024
@vinistock vinistock self-assigned this Jun 10, 2024
@vinistock vinistock requested a review from a team as a code owner June 10, 2024 13:37
@vinistock vinistock requested review from andyw8 and st0012 June 10, 2024 13:37
Copy link
Contributor

@Morriar Morriar left a comment

Choose a reason for hiding this comment

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

Good catch!

@vinistock vinistock merged commit abfad7a into main Jun 10, 2024
35 checks passed
@vinistock vinistock deleted the vs/fix_instance_variable_deduping branch June 10, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants