-
Notifications
You must be signed in to change notification settings - Fork 21
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 jump-to-def for associations #373
Conversation
I have signed the CLA! |
👋 Looking into the |
Ah, we don't need to listen for class node events, we can use the nesting:
|
I notice the |
Thanks @andyw8! I'm flipping this to ready since it's about good from my end. Ready to review whenever! How do I go about upstreaming the behavior we need for the Builder classes? Can we merge this with the private interfaces if we have the next steps for a better interface? |
rescue NameError => e | ||
{ | ||
result: { | ||
error: e.message, | ||
}, | ||
} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the right behavior here; I opted to return the error message; but I think would could return a nil result just like when the model name doesn't resolve properly. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think returning nil
is more appropriate here.
Thinks make me think though: Sometimes it's confusing for the user if they try something and the editor seems to do nothing. Perhaps there could be an info
response, which prints something to the log in these kinds of situations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched it to nil
for now. I like the idea of having info responses print to the log. Should we add an issue to add that support?
Nice! I found there's a simpler way than using the I branched off your PR and added a couple of commits in this branch: https://github.com/Shopify/ruby-lsp-rails/compare/andyw8/go-to-def-assoc If you want to update your branch then go ahead, otherwise I can things over from here. |
@andyw8 Thanks! I was looking for a more stable way too and this works great. I pulled in your commits and cleaned up the PR some more. Should be good for another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of comments. This looks great!
Co-authored-by: Vinicius Stock <vinistock@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but linting is failing
@vinistock Ahh yes, GH PR additions always get me. Should be good to go 👍🏻 |
btw we're starting on fixing the target behaviour so you'll be to right click on the symbol rather than the |
Closes #358
Adds support for jump to definition for
belongs_to
,has_one
,has_many
andhas_and_belongs_to_many
associations on models.