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 support for private_class_method in the indexer #2781

Closed
vinistock opened this issue Oct 25, 2024 · 1 comment · Fixed by #2858
Closed

Add support for private_class_method in the indexer #2781

vinistock opened this issue Oct 25, 2024 · 1 comment · Fixed by #2858
Labels
enhancement New feature or request good-first-issue Good for newcomers rubyconf-hackday server This pull request should be included in the server gem's release notes

Comments

@vinistock
Copy link
Member

Very similar to #2653 and how we handle private constants. We need to start taking private_class_method into consideration in the indexer.

When not using the class << self syntax, the private method has no impact whatsoever on the visibility of methods and the only way to mark them as private is by invoking private_class_method.

class Foo
  private

  # this method is public
  def self.bar
  end

  # this makes it private
  private_class_method(:bar)
end

Essentially, we need to:

  • Add a new branch here to handle the private_class_method
  • Grab the entry that was already inserted in the index for that method and owner combination
  • Mark the method as private
@vinistock vinistock added enhancement New feature or request good-first-issue Good for newcomers server This pull request should be included in the server gem's release notes labels Oct 25, 2024
@kcdragon
Copy link
Contributor

I'm going to take a look at this at the RubyConf hack day.

kcdragon added a commit to kcdragon/ruby-lsp that referenced this issue Nov 14, 2024
vinistock pushed a commit that referenced this issue Nov 21, 2024
* Support `private_class_method` in the indexer

Fixes #2781

* Apply suggestions from code review

Co-authored-by: Andy Waite <[email protected]>

* Fix tests

* Remove unnecessary conditional

* Support `private_class_method` being called with a method definition

---------

Co-authored-by: Andy Waite <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good-first-issue Good for newcomers rubyconf-hackday server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants