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

Avoid showing private methods for external references #2783

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

vinistock
Copy link
Member

Motivation

I noticed that we were suggesting private methods even if the reference would be invalid. This PR fixes that.

Implementation

You can only call a private method from within the namespace where it is defined, so we can just check if the resolved type is the same as the current nesting.

Automated Tests

Added a test that reproduces the issue and doesn't pass before the fix.

@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 Oct 25, 2024
@vinistock vinistock self-assigned this Oct 25, 2024
@vinistock vinistock requested a review from a team as a code owner October 25, 2024 19:03
test/requests/completion_test.rb Show resolved Hide resolved
@vinistock vinistock force-pushed the vs-dont-show-private-methods branch from ff8460c to a04a6bd Compare October 25, 2024 20:20
@vinistock vinistock merged commit 0baf620 into main Oct 25, 2024
33 of 36 checks passed
@vinistock vinistock deleted the vs-dont-show-private-methods branch October 25, 2024 20:45
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