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 go to definition #37
Conversation
Do you know why the last commit failed???? |
And does these packages go to definitions for all packages that are installed??? I mean if I have code like that |
Hi @minkir014, the checks failed for two reasons:
Happily, both those issues seem to be resolved now. For packages, there isn't really a 'definition' to go to. So in the |
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.
@andycraig this is great work, thank you.
A future feature that registers, e.g., all files in the current project would make Go to Definition more useful.
Yes, this would be great!
Running the unit tests using
devtools::test()
requires that the package already be installed (not just withdevtools::load_all()
). Otherwise, the unit tests hang. This seems to be the case withmaster
too, though.
Yes, I don't know why it behaves that way but I noticed the same behavior.
@andycraig excellent work. I will take a look as soon as possible. @Tutuchan feels free too give any comments. |
Do you mean that go to definition won't work until the files are opened for local purpose??? |
@minkir014 For functions in local files (not packages), that’s correct. This is the same for other features like Code Completion and Hover. |
It happened to me. I think this is because the R process run by https://github.com/REditorSupport/languageserver/blob/master/R/languageclient.R#L18 does not find the package, since it is not installed. But there is not any error check at this point. |
I don’t think I will have time review it in details in the near future. After a quick skim, I guess we could merge it first and evaluate. |
@randy3k Sounds good. If you have comments in the future, let me know and I'll be happy to make fixes etc. as required 👍 |
Closes #34
This PR adds Go to Definition functionality.
@Tutuchan added the infrastructure and code to go to definitions of functions in packages; I added code to go to definitions in local files.
The following rules are used:
pkg::
qualifier will look for that function first in packagepkg
and then in local files;pkg::
qualifier will look for that function first in local files and then in loaded packages.Note that the language server only becomes aware of functions in local files as those files are registered via
didOpen
etc. A future feature that registers, e.g., all files in the current project would make Go to Definition more useful.@Tutuchan I have rebased your commits and my commit onto
master
.Running the unit tests using
devtools::test()
requires that the package already be installed (not just withdevtools::load_all()
). Otherwise, the unit tests hang. This seems to be the case withmaster
too, though.