MikhailArkhipov / vscode-r

R Tools for VS Code
Other
82 stars 6 forks source link

Feature request: Ability to specify R path #4

Closed jacob-long closed 5 years ago

jacob-long commented 5 years ago

I have multiple R installations because I am a package developer and sometimes need to troubleshoot on dev builds. For some reason, this extension is opening up a dev build of R even though it is not in my PATH. At least, another version of R takes precedence when I use the command prompt (I am using Windows 10 Oct 2018 release).

I wonder if it would be possible — and hopefully not too much dev effort — to have a parameter in the settings for users to provide a path to the R installation to override the default if needed.

Thanks for your work putting this extension together.

MikhailArkhipov commented 5 years ago

The broker (ASP.NET Core process) is configurable via Microsoft.R.Host.Broker.Config.json. Ex

       "r":{"autoDetect":"<true|false>"}
              Auto detect R interpreters. This option looks for installed CRAN R (>= 3.2) and Microsoft R Open (>= 3.2) packages. Default is true.
       "r":{"interpreters":[{"name":"<interpreter-name>","basePath":"<path>"},...]}
              Add custom R interpreters. The format requires a name and the path to where the interpreter is installed. Example, for CRAN R the path is /usr/lib/R.  Note: CRAN R is detected automatically.

See also https://github.com/Microsoft/RTVS/issues/3265

{
"server.urls": "https://0.0.0.0:5444",
  "R": {
    "Interpreters": {
      "0": {
        "name": "MRO",
        "basePath": "C:\\Program Files\\Microsoft\\MRO-3.3.2"
      },
      "1": {
        "name": "MSSQL R Services",
        "basePath": "C:\\Program Files\\Microsoft SQL Server\\MSSQL13.MSSQL01\\R_SERVICES"
      }
    }
  }
}
jacob-long commented 5 years ago

I'm probably missing something obvious, but I cannot find Microsoft.R.Host.Broker.Config.json on my machine...

MikhailArkhipov commented 5 years ago

You have to create one :-) next to executable. Which should be in ~/.vscode/extension_name/ls

yihengli commented 5 years ago

Hi, thanks for building this extension for VScode users across platforms.

I am recently interested in this feature (specify R path) as well. It seemed like the trick addressed above cannot work on MacOS. Trying to figure out if this is expected.

MacOS: 10.14.2, Code Version: 1.30.1, Extension Verision: 0.0.5, .Net on mac: Core 2.2

It seems like Extension is always looking for R located at /Library/Frameworks/R.framework/Versions. I tried to set up a file Microsoft.R.Host.Broker.Config.json under ~/.vscode/extension_name/ls, but it doesn't change this behaviour

{
"server.urls": "https://0.0.0.0:5444",
  "R": {
    "Interpreters": {
      "0": {
        "name": "MRO",
        "basePath": "<path>"
      }
    }
  }
}