vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

WIP: Interactive R tasks

Open ManuelHentschel opened this issue 3 years ago • 0 comments

WIP/Proof of concept. Addresses #1239, #1242.

Makes R tasks interactive by running the specified code from a custom .Rprofile. This feels a bit hacky, but was the only way I managed to make R run code specified in the task description, and still read interactive responses from stdin.

Sourcing the original .Rprofile from within the modified one should be possible (is done for the extension's R terminals anyways I think). Not sure what the other drawbacks of this approach are. Since most tasks are not supposed to be interactive, I would probably add this as an optional mechanism, to be enabled in the task definition. To test, define e.g. the following task:

{
  "tasks": [
    {
      "type": "R",
      "code": [
        "print('hello world')",
        "s <- readline()",
        "print(s)"
      ],
      "group": "build",
      "problemMatcher": [],
      "label": "R: Build"
    }
  ]
}

ManuelHentschel avatar Nov 27 '22 21:11 ManuelHentschel