question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

configurable run command in R terminal?

See original GitHub issue

Is your feature request related to a problem? Please describe.

The R extension has keybindings for some key R functions like nrow, devtools::test() etc. It would be nice to be able to configure our own keybindings that run code in the active R terminal.

Describe the solution you’d like

A command added to the extension like this:

    async function runCommandInRTerm({ text }: { text: string }) {
        const callableTerminal = await chooseTerminal();
        if (callableTerminal === undefined) {
            return;
        }
        callableTerminal.sendText(text);
    }

Allows keybinding config like this to work:

[
  {
    "description": "run drake::r_make()",
    "key": "ctrl+;",
    "command": "r.runCommandInRTerm",
    "when": "editorTextFocus",
    "args": {
      "text": "drake::r_make()\n"
    }
  }
]

Describe alternatives you’ve considered

Adding commands directly to the extension via PRs - seems unlikely to scale well and create unnecessary maintenance overhead for niche use cases.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MilesMcBaincommented, Jan 24, 2020

I’ll have a go.

Another idea I had is a variant of this that take the current word or selection and sends it as an arg.

Would enable stuff like:

[
  {
    "description": "loadd target under cursor",
    "key": "ctrl+l",
    "command": "r.somethingSomethingWithSelectionOrWord",
    "when": "editorTextFocus && editorLangId == 'r'",
    "args": "drake::loadd"
  }

Thoughts on that one?

0reactions
renkun-kencommented, Feb 22, 2020

Closed by #237.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Comprehensive Introduction to Command Line for R Users
In this tutorial, you will be introduced to the command line. We have selected a set of commands we think will be useful...
Read more >
4 ways to be more productive, using RStudio's terminal
1. Execute resource-heavy R code in the Terminal quickly · Shift + Alt + R Shift + Alt + R to open a...
Read more >
How do I configure R so programs developed in RStudio run ...
We want to be able to develop programs in RStudio, and then run them from a command line (i.e., in batch mode in...
Read more >
Run R command from command line - Stack Overflow
You can do it with the R command: $ R --slave -e '1+1' [1] 2. From man R : --slave Make R run...
Read more >
R Installation and Administration
R will configure and build under most common Unix and Unix-alike platforms ... You can run command-line R and Rscript from a Terminal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found