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 references support for instance variables #2641

Open
vinistock opened this issue Oct 1, 2024 · 5 comments · May be fixed by #2787
Open

Add references support for instance variables #2641

vinistock opened this issue Oct 1, 2024 · 5 comments · May be fixed by #2787
Assignees
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale server This pull request should be included in the server gem's release notes

Comments

@vinistock
Copy link
Member

Build on top of #2632 to add support for finding instance variable references.

@vinistock vinistock added enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale server This pull request should be included in the server gem's release notes labels Oct 1, 2024
@monkeyWzr
Copy link

Hi there!
Still digging but I'd love to give this one a try!

@vinistock
Copy link
Member Author

Hello! Awesome. If you have any doubts or get blocked, let us know and we can help!

@monkeyWzr
Copy link

Hi @vinistock
Sorry for the delay! I got completely distracted by the Factorio: Space Age 😅

I'm not certain if this functionality should narrow down the instance variable's context the way Go to Definition does. It took me some time to figure out how Go to Definition works.

Based on the LSP specification,

The references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position.

I suppose finding all matched instance variables beyond context should be OK?

I’ve opened the PR and would appreciate your review! #2787

@andyw8
Copy link
Contributor

andyw8 commented Oct 30, 2024

It might be worth checking what other language servers do, but I suspect we shouldn't be matching on instance variables in other contexts, since they may be named co-incidentally, whereas for constants and class/module names, we can (generally) determine that they refer to the same thing.

@monkeyWzr
Copy link

monkeyWzr commented Oct 30, 2024

@andyw8 Thanks for you suggestion!

Totally agree with you but I forget to mention that I did check latest Solargraph and RubyMine. For Solargraph in VSCode, Find All References lists all usages despite of context (even for Go to Definition).

And For RubyMine, it's more detailed and list all others as Untyped (potential) usage

(Solargraph v0.50.0 in VSCode)

(RubyMine 2024.1.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale 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