REditorSupport / REditorSupport/vscode-R

Smart keyboard shortcut for inserting block

Open
#1,594 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Is your feature request related to a problem? Please describe.
When inserting an R code block in a .rmd notebook using the keyboard shortcut cmd + option + i, the behavior is not 'smart' like it is in Rstudio - it 'nests' blocks rather than 'splitting' them.

```{r}
# some code here

# put cursor here

# more code here
```

For example, if you place your cursor at the location noted in the block above, then press cmd + option + i, you get:

```{r}
# some code here

```{r}
```

# more code here
```

This 'nested' syntax is undefined. Instead, it should produce:

```{r}
# some code here

```

```{r}

# more code here
```

I think this can be accomplished by setting a 'context key' in the extension whenever the cursor is in a block, then creating two keybindings, one for inside a block, another for outside a block.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the extension's handling of the cmd + option + i shortcut and the proposed context key and keybindings for R Markdown blocks. Reproduce the nested-block behavior inside an R code block, then verify that the shortcut splits the block there while retaining the existing insertion behavior outside blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.