Skip to content

Make "Run line" to work on partial statements (e.g. code blocks, loops, etc.) #4431

@ghost

Description

Feature request

In RStudio, given a function with arguments spread out over multiple lines, e.g.:

data.frame(a = c(1, 2, 3),
           b = c(4, 5, 6),
           row.names = c('x', 'y', 'z'))

The use of "run current line" (using shortcut or menu) is less literal in RStudio than in Spyder, as the entire function is run rather than just isolated lines, returning the desired data frame. This works in a number of cases (loops, functions, dplyr/tidyr pipelines, etc.) and can be quite a time-saver, since you don't have to worry about highlighting longish blocks of code to run them.

Similar functionality is possible in Spyder using cells, but I think cells are a better tool for segmenting code according to logical steps in the coding/analysis process, and not so much for isolating individual functions and loops. Would it be possible to implement this feature in some future Spyder version?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions