Skip to content

Execute *JUST* the selected code (eventually removing the tabulation) #11

Description

@giubenez

I often want to check if the code I'm writing inside a for loop works or not.. but as far as I can understand, the plugin always select the whole for loop to exectute.

Isn't it possible to execute just the selected chunk , in the same way RStudio does? (if nothing is selected the whole self-standing block is executed, but if I select a part of the code only this part is executed).

Thank you in advance

Activity

  1. bitagoras commented on Jul 24, 2023

    @bitagoras
    Owner

    This is language related problem and has to do with the indentation syntax of Python. When I select multiple lines inside a for-loop this will also select the indentation white spaces. And this is no valid python code. The function therefore tries to add a minimum number of lines until the code becomes valid. To run only the selected lines this would require to manipulate the code before it is passed to the interpreter. I am not sure, if this is enough transparent to the user. I understand your problem, but have to think about a solution. My workaround for this is to unindent the code temporarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions