I created a very simple .r file insider a folder and want to debug this file using VSCode.
Here are the steps taken:
- Create a new folder in desktop;
- Create a .r file inside the new folder and add simple R code;
- Load the new folder into VSCode and open the .r file;
- Click the debug icon in VSCode, create a launch.json file and save it to the .vscode folder inside the new folder;
- Click start debugging, the debug floating control pane appears but the step in/out icons are greyed out.
Here is the launch.json file:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "R-Debugger",
"name": "Launch R-Workspace",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}"
},
{
"type": "R-Debugger",
"name": "Debug R-File",
"request": "launch",
"debugMode": "file",
"workingDirectory": "${workspaceFolder}",
"file": "${file}"
},
{
"type": "R-Debugger",
"name": "Debug R-Function",
"request": "launch",
"debugMode": "function",
"workingDirectory": "${workspaceFolder}",
"file": "${file}",
"mainFunction": "main",
"allowGlobalDebugging": false
},
{
"type": "R-Debugger",
"name": "Debug R-Package",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}",
"includePackageScopes": true,
"loadPackages": [
"."
]
},
{
"type": "R-Debugger",
"request": "attach",
"name": "Attach to R process",
"splitOverwrittenOutput": true
}
]
}
Why are the step in/out icons are greyed out? I simply cannot debug R file in VSCode in current state. Thank you.
CodePudding user response:
The error you are getting is:
Error: '.vsc.listenForJSON' is not an exported object from 'namespace:vscDebugger'
This is a known issue caused by an older version of the R package. According to the package maintainer, the solution to this issue is,
You can run
rdebugger.updateRPackage
in the command palette (ctrl shift p) to update the R package. If that doesn't work, there are some installation instructions in the readme.
If your problem still persists after following these instructions, I would considering opening a github issue. Someone opened what appears to be a similar issue 12 days ago so it may be the package has broken on some systems after a recent update either to this package or a dependency.