Skip to content

Create or provide choice for multiple R versions and x64 or i386 architectures for R terminal #696

Closed

Description

@gwd666

Is your feature request related to a problem? Please describe.
No problem only a feature request ...
When hitting CTRL+P the R: Create R terminal command opens up the VSC Terminal and starts a R session based on the Rpath (in my case WINdows) setting, but only allows for one distinct R architecture (either x64 or i386) and/or R version

Because of (mainly database client) driver architecture issues on Windows (ODBC etc) this means a lot of manual hassle with extension Settings in case one would like/need to switch to R i386 architecture (in my case b/c x64 is usually my default) or vice versa.

Describe the solution you'd like
Choice between
R: Create R-x64 terminal and/or select R executable
R: Create R-i386 terminal and/or select R executable

Maybe even side by side - or dropdown?

Describe alternatives you've considered
None so far - I am open for workarounds (eg keyboard shortcuts or similar).

Additional context
NA

PS: this extension of yours ROCKS!

Activity

  1. renkun-ken commented on Jul 5, 2021

    @renkun-ken
    Member

    Have you tried typing in the terminal to start R-x64 and R-i386 terminal and do both work?

  2. gwd666 commented on Jul 5, 2021

    @gwd666
    Author

    Hi
    Sorry I do not fully understand your proposal or hint.
    If I execute a fully qualified path to R_HOME\bin\i386\R.exe or ...x64\R.exe versions in the Terminal the respective R version will start up, yes.
    ALSO the "normal" R/Rterm that I defined in Settings works like a charm as well - no "bug"or so involved here in this "ticket"!

    I was just hoping for a small enhancement to VSC R to be available when hitting the CTRL+P keyboard shortcut.
    image
    One could probably also assume that the respective architectures will be available from R_HOME\bin\ in the i386 and ...x64 subfolders. Not so sure about how that would look like / work with radian (since I do not use that). But for defining Rterm path in the R extension Settings you would also have to decide the ARCH - a lot like in RStudio, where you always have to restart after changing the ARCH, but I thought maybe these Setting changes could be avoided for the R: Create R terminal command, if this was available via CTRL+P?
    No worries - it still is mainly just a "feature request" (imho) for UX and def not a bug!
    What is your opinion - you think that is useful? The use-case is that I have some packages that require 32-bit R (as mentioned above because of some 32 bit driver architecture for Windows mainly ODBC stuff) and I sometimes forget about having to change that default Rterm path Setting and after a couple of weird Errors and changing it for some development I also always need to remember to revert it back again, etc. Would be more convenient to have that around with CTRL+P, I was guessing.

  3. gwd666 commented on Jul 5, 2021

    @gwd666
    Author

    OTHERWISE ... I forgot to mention that for R DEV work I can or usually always do "tweak" the Workspace R extension Setting accordingly! It is mainly when I use VSC interactively ie when I use that package (with its 32 bit driver dependency) that I tend to forget or need to switch the R-ARCH in the "User" Settings.

  4. ManuelHentschel commented on Jul 5, 2021

    @ManuelHentschel
    Member

    I can 100% understand where you're coming from, but I'm not quite sure what the best approach would be here. E.g. when a new R version is released which I want to try, but not switch to permanently (yet), I'm in a similar situation as you, but not between architectures but R versions.

    Also, e.g. in #597 we're looking to simplify the path settings, to make using the extension easier for new users, and adding support for different architectures/versions is somewhat contradictory to this.

    The alternative that currently works best for me is to not use r.path.xxx and r.term.xxx at all, and simply have the version I'm currently using on the PATH. Or if the R path is project specific, using the settings.json, but you already mentioned that that wouldn't help with your current issue.

    A solution that might work for you without making the configuration more complicated for new users might be the following:

    • Have an extra (hidden?) setting, where you can specify additional R paths.
    • The first time, an R path is required by vscode-R, the user is asked, which R path to use (similar to what the python extension does)

    This would be opt-in without cluttering the regular path settings for most users and flexible enough to be used for different architectures/versions etc.. And un-setting this setting in a given workspace would avoid asking for the R path all the time.

  5. renkun-ken commented on Jul 5, 2021

    @renkun-ken
    Member

    What if we accept multiple paths in r.term.xxx? User could specify a single path (currently supported) or multiple paths separated by ;. If multiple paths are specified, then "R: Create R terminal" will show a picker for you to decide which one to use?

    @ManuelHentschel @gwd666 Does it sound okay?

  6. ManuelHentschel commented on Jul 5, 2021

    @ManuelHentschel
    Member

    Sounds good!

    Note that on windows ; can be part of a path, but e.g. requiring such paths to be quoted should work fine.

    I'd also suggest implementing the same mechanism for r.path.xxx.

  7. gwd666 commented on Jul 5, 2021

    @gwd666
    Author

    I can 100% understand where you're coming from, but I'm not quite sure what the best approach would be here. E.g. when a new R version is released which I want to try, but not switch to permanently (yet), I'm in a similar situation as you, but not between architectures but R versions.

    This [multiple R versions] is definitely also a very valid and common scenario.
    @renkun-ken @ManuelHentschel - I do like the multiple paths approach, especially since this would as a result fix one of the major inconveniences you usually have in RStudio in the VSC editor.
    Looking forward to your ideas and if this feature will make it into one of the future releases.
    Thanks ...

  8. renkun-ken commented on Jul 5, 2021

    @renkun-ken
    Member

    I'd also suggest implementing the same mechanism for r.path.xxx.

    If multiple paths are specified in r.path.xxx, then starting background processes (e.g. R help, language server) should prompt?

  9. ManuelHentschel commented on Jul 6, 2021

    @ManuelHentschel
    Member

    If multiple paths are specified in r.path.xxx, then starting background processes (e.g. R help, language server) should prompt?

    Yes, once per session. Normally, people will have only one path here, but if someone decides to put multiple paths in r.path.xxx, this is the behaviour I'd expect.

    Edit: Also, should the r.term.xxx be decided for each terminal individually or once per session? For my personal usecase, once per session would be enough, but others might prefer to choose for each terminal.

  10. ElianHugh commented on Jul 6, 2021

    @ElianHugh
    Collaborator

    If its of any use, the python extension does a neat thing where you can set the interpreter

    https://code.visualstudio.com/docs/languages/python

    Screenshot_20210706-200518_Firefox.jpg

  11. renkun-ken commented on Jul 6, 2021

    @renkun-ken
    Member

    I was thinking about exactly the same thing as @ElianHugh suggests.

  12. gwd666 commented on Jul 6, 2021

    @gwd666
    Author

    @renkun-ken and @ElianHugh - I also like the idea of not reinventing the wheel and presenting people with something "familiar" partly also b/c the intersection of Py and R users (bilingual ones using both extensions) is probably quite significant and that similarity could end up being a nice "muscle memory" feature then

  13. changed the title [-]Create or provide choice for x64 or i386 R terminal (for Windows) [/-] [+]Create or provide choice for multiple R version and x64 or i386 architectures for R terminal[/+] on Sep 29, 2021
  14. changed the title [-]Create or provide choice for multiple R version and x64 or i386 architectures for R terminal[/-] [+]Create or provide choice for multiple R versions and x64 or i386 architectures for R terminal[/+] on Sep 29, 2021
  15. 23 remaining items

  16. hermidalc commented on Jun 29, 2022

    @hermidalc

    @hermidalc just for my understanding but aren't some of the points above things that can (already) be handled via the renv package? or what would speak against using renv in those cases? excuse if I am missing something obvious that speaks against that package; and I am already using .workspace files most of the time to manage "r-binary" paths for my projects and a local .Renviron also can do a lot of good things in those scenarios, but I would of course also prefer a more "natural" R VSCode extension method to be available as mentioned before ideally resembling some of the Python extensions workflow (sort of "muscle memory" in that context)

    Because renv is an R ecosystem only dependency manager. mamba/conda and conda-forge are a dependency manager that has python, R, perl, java, rust, etc dependency management. Most of the projects I work on use both python and R code in the same Github repo, and I'm sure for many others they do the same too. Good examples are using snakemake and rpy2 in your projects, which are great libraries and involve using python and R. Many people aren't bound or stick with a single language and ecosystem.

    Using multiple languages seamlessly in the same project is what originally gravitated me towards Atom back when I started using it in 2017. Now that Atom's future is uncertain I'm trying to use VSCode but the R side is currently lacking.

  17. hermidalc commented on Jun 29, 2022

    @hermidalc

    Sorry to add something, VSCode already has full support for conda for Python, and at the project folder level which is what developers need, so all that infrastructure is there in VSCode for R to do the same thing. Why spend effort to support another dependency manager that is limited to only R when conda has full R dependency management plus for other languages.

  18. eitsupi commented on Jun 29, 2022

    @eitsupi
    Member

    Why spend effort to support another dependency manager that is limited to only R when conda has full R dependency management plus for other languages.

    I believe many R users do not use conda to install R. In that case they cannot use conda or mamba, right?
    While there are certainly many R packages in conda-forge, it does not cover all packages in CRAN nor does it necessarily install the latest R versions.

  19. hermidalc commented on Jun 29, 2022

    @hermidalc

    Why spend effort to support another dependency manager that is limited to only R when conda has full R dependency management plus for other languages.

    I believe many R users do not use conda to install R. In that case they cannot use conda or mamba, right? While there are certainly many R packages in conda-forge, it does not cover all packages in CRAN nor does it necessarily install the latest R versions.

    You're not bound to use conda at all in VSCode... With vscode-python it searches and finds all interpreter/environment paths, including your system ones or other ones outside of conda. See my screenshot below after clicking Python: Select Interpreter. It shows all my python paths including my system ones and other ones outside of my conda envs.

    This is exactly how vscode-R should work, so it continues providing the same support it already did for ppl who don't use conda and then also for people who do and who do it at the Github repo/project folder level.

    Screenshot from 2022-06-29 11-39-57

  20. gwd666 commented on Jun 29, 2022

    @gwd666
    Author

    I am definitely sold on that feature extension. And props to the (two) main developers/maintainers here!
    That extension of yours is definitely a great addition the the R ecosystem imho not replacing RStudio but extending it to more types of use-cases.
    And tbh if it takes more than a couple of steps or iterations to get there -> also fine by me ... to me it looks like it will be worth the "wait"

  21. hermidalc commented on Jun 29, 2022

    @hermidalc

    Me too, will make VSCode really usable for me. And I will beta test whatever you need

  22. ElianHugh commented on Jun 30, 2022

    @ElianHugh
    Collaborator

    Thank you all for the feedback. We are a tiny repo in comparison to the python extension + don't have the resources of a full-time dev, so any and all help (be it feedback, testing, or dev work) is greatly appreciated.

  23. hermidalc commented on Jun 30, 2022

    @hermidalc

    I'm not experienced with doing VSCode extension dev work, but absolutely will do any testing and give detailed feedback on what you develop. We know how it should look and work because fortunately we can see it with vscode-python. Maybe connect with those devs to know how they did it, which they did very well. I know they use Pylance but I'm sure if you didn't have Pylance activated in your settings and in each of your folders connected to their respective conda environment (or system environment) you had python-lsp-server language server installed it could be set to use that, just like r-languageserver.

    Atom couldn’t support a conda environment per project folder, which was a shame for developers that needed different environments per project it made things clunky because had to relaunch it in diff conda envs, but with Atom if you launched it from an activated conda env with python-lsp-server and r-languageserver installed and ide-python and ide-r Atom extensions installed it would work beautifully.

  24. ElianHugh commented on Jul 2, 2022

    @ElianHugh
    Collaborator

    Hi @ManuelHentschel,

    At the moment the help server is spun up globally with a static path. If I was looking to have a separate help server per workspace folder (i.e. for multiroot), would it be viable to have a map of help servers rather than one global server?

  25. ManuelHentschel commented on Jul 2, 2022

    @ManuelHentschel
    Member

    Hi @ManuelHentschel,

    At the moment the help server is spun up globally with a static path. If I was looking to have a separate help server per workspace folder (i.e. for multiroot), would it be viable to have a map of help servers rather than one global server?

    Yes that shouldn't be a problem. We could just have multiple instances of the classes in helpProvider.ts, and the methods RHelp.getHelpFileForPath etc. would need to be rewritten to use the correct providers (or e.g. try them all in order). If you like, I can implement this, just let me know your specific requirements.

  26. ElianHugh commented on Jul 3, 2022

    @ElianHugh
    Collaborator

    Absolutely, that would be fantastic! I'll try to setup a WIP PR for reference either tonight or tomorrow, just need to tidy up a bit first :)

  27. github-actions commented on Jul 10, 2023

    @github-actions

    This issue is stale because it has been open for 365 days with no activity.

  28. github-actions commented on Jul 25, 2023

    @github-actions

    This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions