You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good question. The fact is there were no plans. It lets me think of the following road map. Some of the items below may lead to developments of new packages.
Short term and easy tasks
Linting/Diagnostics (basically done)
Basic auto completion:
Signature help (hints for function arguments)
References for objects in default packges
References for objects in form of foo::bar or xyz:::abc
Medium term
Formatting: styler seems to be a better alternative to formatR which is what I had in mind.
Auto completion of attached functions via library and require, it requires an inspection the use of library() if it is a script or an inspection of NAMESPACE file if it is a package
References of attached functions (similar to auto completion)
Code Lens
Go to definition
Long term and/or difficult tasks
Robust refactoring (code action)
Hook into an active R session and do object completions (something nvimcon of Nvim-R).
Reacted by Yuki Ueda, Hongyuan Jia, Varvenza, Yuri Dias, Jakob Gerhard Martinussen and Gustavo Velásquez
I think you really need to query the R session to do anything like detecting attached packages. R code can attach packages implicitly if they are in Depends in another package, explicitly in R code with attach() and other ways. Doing so with lexical analysis alone is going to be brittle.
Probably you need something like nvimcom that provides bi-directional communication between the R process and the language server process, this will also let you do object completions easily.
For completions it would also be nice if the package supported custom completions defined using R's rc.options("custom.completer") see ?rc.options for more details. I have a new completeme package that will make it much easier for package authors to define custom completions and have them work in tandem, so while there are few examples today there will likely be more in the near future.
@randy3k What's the benefit in using the language server instead of Hydrogen, which uses the R Jupyter Kernel. In my experience, Hydrogen has auto-completion based on attached packages.
They are different concepts. Language server would be useful in any R files to provide language support. For example, if you are developing an R package, I am quite sure that you don't run Hydrogen on top of the R files. Hydrogen is mainly useful if one is doing data analysis.
@jimhester
It is hard to fully support what RStudio offers via lexical analysis without querying a R session. Inspecting the use of library, the NAMESPACE file and scanning "Depends" iteratively should be sufficient in most cases. The Language server is just a helper anyway, we don't expect it to work under all circumstances.
Discussing something like nvimcom is also too early for now. I also envision such implementation and have put into in the long term target.
Didn't know that there is an option to specify custom completer. Thank for letting me know.
As a Vim user who doesn't use Nvim-R (there are dozens of us!), I can't tell you how much I appreciate your work on this. Having the LSP is an order of magnitude improvement over life before.
A long-term goal could also be supporting Rmarkdown documents. Even the smaller subset of features currently provided by the package would be really handy there too.
Thanks!
Reacted by guillaumechaumet, Paul Klemm, Jarod G.R. Meng, frodera, Karolis Koncevičius, Randy Lai, Pierre Camilleri, Max Held and Evgeni Chasnovski
Do you know if there is any package for providing go to definition? Or you can do manually that by searching the workspace and choosing the one that matches the definition in the syntax.
Activity
randy3k commentedon Sep 13, 2017
Good question. The fact is there were no plans. It lets me think of the following road map. Some of the items below may lead to developments of new packages.
Short term and easy tasks
foo::barorxyz:::abcMedium term
stylerseems to be a better alternative toformatRwhich is what I had in mind.libraryandrequire, it requires an inspection the use oflibrary()if it is a script or an inspection ofNAMESPACEfile if it is a packageLong term and/or difficult tasks
jimhester commentedon Sep 13, 2017
I think you really need to query the R session to do anything like detecting attached packages. R code can attach packages implicitly if they are in
Dependsin another package, explicitly in R code withattach()and other ways. Doing so with lexical analysis alone is going to be brittle.Probably you need something like nvimcom that provides bi-directional communication between the R process and the language server process, this will also let you do object completions easily.
For completions it would also be nice if the package supported custom completions defined using R's
rc.options("custom.completer")see?rc.optionsfor more details. I have a new completeme package that will make it much easier for package authors to define custom completions and have them work in tandem, so while there are few examples today there will likely be more in the near future.kylebarron commentedon Sep 13, 2017
@randy3k What's the benefit in using the language server instead of Hydrogen, which uses the R Jupyter Kernel. In my experience, Hydrogen has auto-completion based on attached packages.
randy3k commentedon Sep 13, 2017
They are different concepts. Language server would be useful in any R files to provide language support. For example, if you are developing an R package, I am quite sure that you don't run Hydrogen on top of the R files. Hydrogen is mainly useful if one is doing data analysis.
kylebarron commentedon Sep 13, 2017
I'll read more about the language server protocol, and might be interested in contributing in the future.
[-]Goals for the language server?[/-][+]Roadmap for Language Server[/+]randy3k commentedon Sep 14, 2017
@jimhester
It is hard to fully support what RStudio offers via lexical analysis without querying a R session. Inspecting the use of
library, theNAMESPACEfile and scanning "Depends" iteratively should be sufficient in most cases. The Language server is just a helper anyway, we don't expect it to work under all circumstances.Discussing something like nvimcom is also too early for now. I also envision such implementation and have put into in the long term target.
Didn't know that there is an option to specify custom completer. Thank for letting me know.
michaelquinn32 commentedon Feb 28, 2018
As a Vim user who doesn't use Nvim-R (there are dozens of us!), I can't tell you how much I appreciate your work on this. Having the LSP is an order of magnitude improvement over life before.
A long-term goal could also be supporting Rmarkdown documents. Even the smaller subset of features currently provided by the package would be really handy there too.
Thanks!
minkir014 commentedon May 24, 2019
You must take care of supporting go to definition.
randy3k commentedon May 24, 2019
We appreciate any contributions. If you want to contribute, I am happy to give some guidance.
minkir014 commentedon May 24, 2019
Do you know if there is any package for providing go to definition? Or you can do manually that by searching the workspace and choosing the one that matches the definition in the syntax.
randy3k commentedon May 24, 2019
We will need to manually search for the definitions and apply the match. That's one of the reasons why I still haven't implemented it.
minkir014 commentedon May 24, 2019
Something else I want to ask you about.
Have you implemented yet symbol outlining??
ThomasSoeiro commentedon Sep 26, 2026
@randy3k Perhaps it can either be closed or updated and pinned?
randy3k commentedon Sep 26, 2026
it is obsolete, may be we could just close it.