-
Notifications
You must be signed in to change notification settings - Fork 163
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 extend self
in the indexer
#2782
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
added
enhancement
New feature or request
server
This pull request should be included in the server gem's release notes
good-first-issue
Good for newcomers
labels
Oct 25, 2024
This approach seems great: as a hint, could someone point at where you'd adjust that logic and then expose to the language server that we have new singleton methods? EDIT: Getting MUCH closer, think I have the above questions answered. |
tlemburg
pushed a commit
to tlemburg/ruby-lsp
that referenced
this issue
Nov 14, 2024
By adding the instance methods as class methods through the singleton mixin operations, we are able to get all instance methods "copied" over into the class methods implicitly. I don't think it's necessary to test whether this extend self applies when the module is opened after being closed again, or re-opened in another file. Closes Shopify#2782
tlemburg
added a commit
to tlemburg/ruby-lsp
that referenced
this issue
Nov 14, 2024
By adding the instance methods as class methods through the singleton mixin operations, we are able to get all instance methods "copied" over into the class methods implicitly. I don't think it's necessary to test whether this extend self applies when the module is opened after being closed again, or re-opened in another file. Closes Shopify#2782
tlemburg
added a commit
to tlemburg/ruby-lsp
that referenced
this issue
Nov 18, 2024
By adding the instance methods as class methods through the singleton mixin operations, we are able to get all instance methods "copied" over into the class methods implicitly. I don't think it's necessary to test whether this extend self applies when the module is opened after being closed again, or re-opened in another file. Closes Shopify#2782
tlemburg
added a commit
to tlemburg/ruby-lsp
that referenced
this issue
Nov 19, 2024
By adding the instance methods as class methods through the singleton mixin operations, we are able to get all instance methods "copied" over into the class methods implicitly. I don't think it's necessary to test whether this extend self applies when the module is opened after being closed again, or re-opened in another file. Closes Shopify#2782
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
If you invoke
extend self
in a module, every instance method added to that module becomes available as singleton methods as well, all with public visibility.Handling this a bit tricky because you can invoke
extend self
anywhere in the body of the module. I think the right way to handle this is like this:extend self
, we take every instance method the module defines and add their singleton versions to the index as wellself
Since modules can be re-opened in multiple files, I think that's the only way to guarantee that we end up with an accurate representation.
The text was updated successfully, but these errors were encountered: