mikhailarkhipov / vscode-r Goto Github PK
View Code? Open in Web Editor NEWR Tools for VS Code
License: Other
R Tools for VS Code
License: Other
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.
[Info - 2:02:45 PM] Available R interpreters:
[Info - 2:02:45 PM] [0] CRAN R '3.6.0-2disco'
[Info - 2:02:45 PM] You can specify the desired interpreter index in the R settings
[Info - 2:02:45 PM] Selected interpreter: [0] CRAN R '3.6.0-2disco'.
[Info - 2:02:45 PM] Starting R Process with /usr/lib/R...
[Error - 2:02:47 PM] Connecting to R Workspace failed.
Reason: R session process did not start on the machine 'VSCR'. Exception: Key has expired
By "support," I mostly just mean syntax highlighting and the ability to send code from code chunks to the active R session.
#7 still occurs "if the active file in the editor is not an R file" as noted in #7 (comment)
i was happy to find the old issue which told this newbie to vscode-r what the workaround was - but i could imagine someone being stumped/blocked even longer than I was.
When run inside VSCode, the R interpreter seems to ignore the .Renviron
file in the user docs folder. However, it does read the .RProfile
in the user docs folder. It will also read a Renviron.site
file in R\etc
(if one exists). I have confirmed that the user .Renviron
file is read when running R outside VSCode and also in Visual Studio 2019 (RTVS).
Request:
Support for .NET 5.0. 3.1 LTS won't last forever.
When I start VS Code and open an R script, R Tools does not start.
The logs show this:
Stack:
I did have .NET 5.0.1 installed originally, but R Tools could not launch for the same reasons as above. When I downgraded to 3.1, I followed the directions here to remove 5.0.1.
[Info - 1:05:33 AM] Available R interpreters:
[Info - 1:05:33 AM] [0] CRAN R '3.6.1-3xenial'
[Info - 1:05:33 AM] You can specify the desired interpreter index in the R settings
[Info - 1:05:33 AM] Selected interpreter: [0] CRAN R '3.6.1-3xenial'.
[Info - 1:05:33 AM] Starting R Process with /usr/lib/R...
[Error - 1:05:35 AM] Connecting to R Workspace failed.
Reason: R session process did not start on the machine 'VSCR'. Exception: Key has expired
In R, many basic function names contain .
(e.g., list.files
, t.test
), and some package names also do (e.g. data.table
). The autocompletion does not seem to support any symbol that contains any dot.
I have installed conda and R in Windows 10. Right now I have not added conda to my path, which is the recommended installation option.
Is there a way to have R Tools initiate a conda environment and use that R interperter?
Code completion does not seem to work when using the $
symbol i.e., df$
does not offer a list of variables. Is this a known limitation or am I doing something wrong?
Relevant info:
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G95
1.38.0
3db7e09f3b61f915d03bbfa58e258d6eee843f35
x64
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Thanks.
Mojave - looks like idle may be happening before server is fully initialized
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.R.LanguageServer.Services.IdleTimeService.HandleIdle() in C:\vscode-r\src\LanguageServer\Impl\Services\Idle\IdleTimeService.cs:line 35
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
[Info - 3:56:30 PM] Connection to server got closed. Server will restart.
[Info - 3:56:32 PM] Available R interpreters:
[Info - 3:56:32 PM] [0] R 3.4
I R Tools provide a command Execute current line or selection in terminal
with shortcuts Ctrl + Enter
. But if it is possible to run a chuck with Ctrl + Enter
, just like what R Studio does? It is really important for pipeline operation, to select code chuck mannually is not always easy, especially for plenty lines code.
The 0.0.1 extension works but 0.0.2 no longer works under Ubuntu 18.04 with the following log:
Checking for .NET Core... OK
Installing Homebrew (required to install libzip library)... undefined
Dear community,
in this project, the README.md states that implementing a debugger is on the To-Do-List.
Are there any ongoing attempts? I would really love to be able to debug R in Visual Studio.
Usually, I program in Python. Now with my R-script, I did the same steps as usual:
Setting a breakpoint at a line of desire, and simply press F5 to start the debugging process.
Unfortunately, the debug-config file "launch.json" doesn't comprise of a R-related dictionary entry such as e.g. for python:
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
If I imitate the above code-lines and exchange "python" with "R", it says there is no debugger installed named like that.
Searching the vscode market place for R-debugging doesn't seem to offer anything, which obviously contains a debugger.
The closest I found was the extension R LSP Client.
Nevertheless, after installing it, there was no way for me to add an R-debugger to my launch.json-file,
since there doesn't appear anything related to R in the available options when clicking the Tab "Debug" > "Add configuration ...".
The simple way the debugging process is described here doesn't work for me since when starting a debugging process via F5, vscode selects one of the available debuggers (I have various for python available, such as "Current File", "Remote", "Flask", Django",.. BUT NOTHING FOR R).
I'd be very happy to get some help, since I really don't want to install RStudio on my system just because I can't debug R-codes in Visual Studio.
Thank you very much in advance!
Kind regards,
Andreas
PS:
The R-version I use is the following:
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
Hello! Trying to move my workflow from sublime to VSCode and so far this package has been helpful. The one thing that's stopping me from committing fully is the ability to view/run my R code in a separate window. In sublime, I used SendCode to get files and code from the editor into R GUI (the application version of R). This has some nice integrated formatting and so on.
I'm wondering if this is possible with vscode-r? Right now, I can only seem to get the code to execute in the VSCode terminal window, but it would be awesome to be able to send this to the R GUI window as well.
On MacOS 10.14.2 with VS Code 1.33.1, I want to use Radian as my R interpreter instead of the normal R implementation. The radian executable file is in /usr/local/bin. I tried using the information in the Readme.md file, but couldn't seem to get it to work. Namely, I tried making generating the fileMicrosoft.R.Broker.Host.Config.json
in the ~/.vscode/extensions/mikhail-arkhipov.r-0.0.6/ls
directory. In it, I put the following:
{
"r":{"autoDetect":"false"},
"r":{"interpreters":[{"name":"radian","basePath":"/usr/local/bin"}]}
}
When I open an R terminal I don't get radian, rather I get what I would get if I opened /usr/bin/R
.
Could you point me in the right direction?
Everytime i start the vscode , i receive the error:
Error in setwd("~") : cannot change working directory
Code: -32000
[object Object]
Before i update the vscode to 1.31.1 in windows10, anything is good.
Thanks.
Managed to load the package properly after some trial and error. But now I'm getting the following error when trying to open a terminal/run code:
"Could not find a part of the path '/Library/Frameworks/R.framework/Versions'."
Seems like the package is looking for R in that folder, but my R is installed by Homebrew and the executable is located in /usr/local/bin/R, and accessible as "R" in PATH. How do I change where the extension looks for the executable?
Hi,
Thanks for a great extension. I think it would be useful to add support for .R
scripts file to work with knitr
comments, that allow the features of comments and code chunks as detailed here.
I'm not sure if this is the right forum for it, apologies if not.
Cheers,
Atanas.
See also microsoft/RTVS#4370
After installing the extension on windows 10 1903 64bit I get the following error after
R: Open Terminal
[Info - 13:26:24] Available R interpreters:
[Info - 13:26:24] [0] R 3.6.0
[Info - 13:26:24] [1] Microsoft R Open (3.5.3.0)
[Info - 13:26:24] [2] R 3.5.2
[Info - 13:26:24] You can specify the desired interpreter index in the R settings
[Info - 13:26:24] Selected interpreter: [0] R 3.6.0.[Info - 13:26:24] Starting R Process with C:\Program Files\R\R-3.6.0... [Error - 13:26:24] Connecting to R Workspace failed. Reason: R Services broker process did not start on the machine 'VSCR'. Exception: Das System hat keinen Meldungstext fΓΌr die Meldungsnummer 0x%1 in der Meldungsdatei %2 gefunden
In the R Tools Startup Log is written:
Checking for .NET Core... OK Activating R Language Server... Startup completed.
Any suggestions what I can do?
Thanks,
Christian
This suddenly appeared in the output pane of the terminal window while I was typing in the editor. Is it something to do with Intellisense?
[Info - 4:19:04 PM] Available R interpreters:
[Info - 4:19:05 PM] [0] Microsoft R Open (3.5.1.0)
[Info - 4:19:05 PM] [1] Microsoft R Client (3.3.2.0)
[Info - 4:19:05 PM] You can specify the desired interpreter index in the R settings
[Info - 4:19:05 PM] Selected interpreter: [0] Microsoft R Open (3.5.1.0).
[Info - 4:19:05 PM] Starting R Process with C:\Program Files\Microsoft\R Open\R-3.5.1\...
[Info - 4:19:08 PM] complete in 00:03:703
[Info - 4:19:08 PM] Building IntelliSense index...
[Info - 4:19:19 PM] complete in 00:10:615
[Error - 4:37:44 PM] Request textDocument/completion failed.
Message: Index was outside the bounds of the array.
Code: -32000
[object Object]
[Error - 4:37:44 PM] Request textDocument/completion failed.
Message: Index was outside the bounds of the array.
Code: -32000
[object Object]
It would be great if users could open multiple R terminals, in the same way that multiple Powershell terminals can be opened at the same time.
Hello. 2 questions please:
Hi there,
I was kicking the tires on this project and had trouble getting this (and, really, any) R-related extension working on Mac. I found this article on RTVS (from Jan 2018), which said:
RTVSis not presently supported on Visual Studio for Mac.
I know that this project is derived from RTVS, so I wondered if that was the root cause (although your extension says it supports Mac). I also tried this on two different Macs and got the same result. Here are the steps I took:
Error:
command 'r.createRTerm' not found
I found this page which suggested running an npm install
in the extension folder. Here's the path where I found it:
/.vscode/extensions/mikhail-arkhipov.r-0.0.5
This didn't help. Here's a dump of what happened:
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/package.json'
WARNWARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/package.json'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/package.json'
tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/README.md'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/isarray-1958e99d/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-glob-c65b67ee/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/is-extglob-3fd7b62d/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/kenwalke/.vscode/extensions/mikhail-arkhipov.r-0.0.5/node_modules/.staging/typescript-6ee193c8/lib/tsserver.js'
npm ERR! code E404
npm ERR! 404 Not Found: [email protected]
I have a tech background and have used R Studio, but I'm not an expert in either of these. I'm an analyst and I mostly use VSC for writing SQL for my day job. I also understand this is a volunteer project, so I appreciate the help!
Thanks,
Ken
Can anyone please give detailed instructions on specifying path to R console or alternative consoles like radian?
As mentioned here, I created a file Microsoft.R.Host.Broker.Config.json
in ~/.vscode/extensions/mikhail-arkhipov.r-0.0.6/ls
folder and specified the following:
The path specified above leads to radian, an alternative R interpreter. However, when I reloaded the window and open R terminal, it is still opening base R terminal instead of radian.
I've come across a weird problem. I have a project, where at one stage I created a directory under c:\users\hongooi\appdata. Then I deleted that directory and forgot about it. Now, I've just discovered that each time VSCode opens that project (or "folder" as it calls it), it recreates that directory.
Would you know what's causing this, and how I can get it to stop?
Some more detail: the code that created the dir was in the .onload
function for an R package, so it got called automatically each time I loaded the package. Later I decided I didn't really need that dir, so I removed the code and deleted the dir. But VSCode refuses to accept that it's gone.
I've confirmed that it's not my code that's doing it, by running rgui.exe and loading the package there. Also, VSC creates the directory before I've even opened the R terminal.
This is using a standard R install on OSX located in /Library/Frameworks/R.framework/.
R tools output:
[Info - 3:46:17 PM] Available R interpreters:
[Info - 3:46:17 PM] [0] R 3.5
[Info - 3:46:17 PM] You can specify the desired interpreter index in the R settings
[Info - 3:46:17 PM] Selected interpreter: [0] R 3.5.
[Info - 3:46:17 PM] Starting R Process with /Library/Frameworks/R.framework/Versions/3.5/Resources...
[Error - 3:46:19 PM] Connecting to R Workspace failed.
Reason: R session process did not start on the machine 'VSCR'. Exception: Unknown error: 134
Hi Mikhail
I'm excited to see RTVS being ported to VS Code, and thanks for your work on this.
Here's a small problem that I'm guessing will be an easy fix. On Windows, if I try: Ctrl+Shift+P > R: Source File then the command issued to the terminal is source("d:\myfolder\myfile.R")
and not surprisingly that leads to an error:
Error: '\m' is an unrecognized escape in character string starting ""d:\m"
The backslashes in the file name need to be replaced with forward slashes do they not?
Philip
I use the following snippets but it would be great if these were added to the package (maybe a bit more clever - i.e. trimming the spaces before and after if not needed)
alt + -
: <-
ctrl + shift + m
: %>%
My r.json
user snippets file:
{
"Assignment operator": {
"prefix": "Assignment operator",
"body": " <- "
},
"magrittr pipe": {
"prefix": "magrittr pipe",
"body": " %>% "
}
}
My custom keybindings.json
file:
[
{
"key": "alt+-",
"command": "editor.action.insertSnippet",
"args": { "langId": "r", "name": "Assignment operator" }
},
{
"key": "ctrl+shift+m",
"command": "editor.action.insertSnippet",
"args": { "langId": "r", "name": "magrittr pipe" }
}
]
Apologies in advance for the really dumb question. I just updated to version 0.02, and I can't seem to find how to get the R console up. Pressing Ctrl-Shift-` just opens the default Powershell console.
Here is the log:
ERR Cannot read property 'kind' of null: TypeError: Cannot read property 'kind' of null
at asHoverContent (C:\Users\hongooi\.vscode\extensions\mikhail-arkhipov.r-0.0.3\node_modules\vscode-languageclient\lib\protocolConverter.js:101:27)
at asHover (C:\Users\hongooi\.vscode\extensions\mikhail-arkhipov.r-0.0.3\node_modules\vscode-languageclient\lib\protocolConverter.js:134:31)
at <anonymous>
VS Code apparently has support for selecting text between e.g. backticks with the command
Ctrl + K + `
However, this doesn't seem to be supported in .Rmd files, i.e. I can select all code in an R chunk and send to console. Could this functionality be added?
Hey,
So I installed R using sudo dnf install R
which installs to the default location, then the extension, then the .Net Core 2.1 Runtime. At this point, it says it can't find the R interpreter. I go to the extension's ls folder and create Microsoft.R.Host.Broker.Config.json with:
{
"R": {
"interpreters": {
"0": {
"name": "R",
"basePath": "/usr/bin/R"
}
}
}
}
Is this the right location for this file? I had a really hard time figuring out where this file should be and this was my best guess since it already had similar files. I also thought the extension should detect the default R installation so I'm not really sure what is going on.
I am using manjaro and vscode1.30.0
Version: 1.30.0
Commit: c6e592b2b5770e40a98cb9c2715a8ef89aec3d74
Date: 2018-12-11T22:21:33.585Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Linux x64 4.19.8-2-MANJARO
and R tool seems not able to find dotnet core and keeps telling me it to install it.
I have install dotnet core 2.1 runtime and later tried dotnet 2.2, but still not work.
I can start dotnet in my terminal without any problem
and also when i try excute line in terminal using command 'r.executeInTerminal', it returned 'command 'r.executeInTerminal' not found'. the same for the rest commands
I see the following error:
[2020-11-17 09:27:09.406] [exthost] [error] [Mikhail-Arkhipov.r] provider FAILED
[2020-11-17 09:27:09.407] [exthost] [error] Error: name must not be falsy
at Function.validate (/home/ucbtmog/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/out/vs/server/remoteExtensionHostProcess.js:548:978)
at new C (/home/ucbtmog/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/out/vs/server/remoteExtensionHostProcess.js:548:927)
at new C (/home/ucbtmog/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/out/vs/server/remoteExtensionHostProcess.js:535:436)
at asSymbolInformation (/home/ucbtmog/.vscode-server/extensions/mikhail-arkhipov.r-0.0.15/node_modules/vscode-languageclient/lib/protocolConverter.js:449:22)
at /home/ucbtmog/.vscode-server/extensions/mikhail-arkhipov.r-0.0.15/node_modules/vscode-languageclient/lib/protocolConverter.js:429:42
at Array.map (<anonymous>)
at Object.asSymbolInformations (/home/ucbtmog/.vscode-server/extensions/mikhail-arkhipov.r-0.0.15/node_modules/vscode-languageclient/lib/protocolConverter.js:429:23)
at /home/ucbtmog/.vscode-server/extensions/mikhail-arkhipov.r-0.0.15/node_modules/vscode-languageclient/lib/client.js:1088:70
I am running this over a vscode SSH setup with the following in my vscode settings.json:
{
"r.interpreterPath": "/home/ucbtmog/.asdf/installs/R/4.0.2/lib64/R/bin/R"
}```
Any ideas on what the issue is?
I'd like to have the output of variables like it would be if I type it into the cli (or like Rstudio has it).
For that, I'd need to set print.eval
to TRUE, but I'd like to avoid setting verbose
(docs). This is currently not possible, but should be in my opinion.
When will you support 32 bit Windows???
It happens when there is nothing on the commandline, and you press Del. R brings up the "Save workspace image? [y/n/c]: " prompt.
Looks like a quoting issue, there are extraneous "s in the source
call. This is what shows up in the R terminal.
source(""c:/Users/hongooi/OneDrive - Microsoft/AzureStor/misc/blob_internal.R"")
On windows 10 64 bit I encounter this exception when the extension is starting:
Unable to start R process. Exception: R Services broker process did not start on the machine '(local)'. Exception: The system cannot find message text for message number 0x%1 in the message file for %2.
and the R Tools terminal outputs
[Info - 12:51:55 pm] Available R interpreters:
[Info - 12:51:55 pm] [0] R 4.0.2
[Info - 12:51:55 pm] You can specify the desired interpreter index in the R settings
[Info - 12:51:55 pm] or provide path to R using `r.interpreterPath` setting.
[Info - 12:51:55 pm] Selected interpreter: [0] R 4.0.2.
[Info - 12:51:55 pm] Starting R Process with C:\Program Files\R\R-4.0.2...
I've tried reinstalling R and the extension but neither solved anything, any fix?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.